27 lines
1.3 KiB
SQL
27 lines
1.3 KiB
SQL
create table if not exists tribe_snapshots
|
|
(
|
|
id bigint generated by default as identity
|
|
primary key,
|
|
tribe_id bigint not null,
|
|
server_key varchar(100) not null
|
|
references servers,
|
|
num_members bigint default 0,
|
|
num_villages bigint default 0,
|
|
points bigint default 0,
|
|
all_points bigint default 0,
|
|
rank bigint default 0,
|
|
dominance double precision default 0,
|
|
date date not null,
|
|
created_at timestamp with time zone default CURRENT_TIMESTAMP not null,
|
|
rank_att bigint default 0,
|
|
score_att bigint default 0,
|
|
rank_def bigint default 0,
|
|
score_def bigint default 0,
|
|
rank_sup bigint default 0,
|
|
score_sup bigint default 0,
|
|
rank_total bigint default 0,
|
|
score_total bigint default 0,
|
|
unique (tribe_id, server_key, date),
|
|
foreign key (tribe_id, server_key) references tribes
|
|
);
|