dcbot/migrations/20230609073054_init.sql

30 lines
1.1 KiB
SQL

-- +goose Up
create table if not exists groups
(
id uuid default gen_random_uuid() not null
primary key,
server_id varchar(100) not null,
channel_gains varchar(100),
channel_losses varchar(100),
internals boolean default false,
barbarians boolean default false,
server_key varchar(50) not null,
version_code varchar(6) not null,
created_at timestamp with time zone default CURRENT_TIMESTAMP not null
);
create table if not exists monitors
(
id uuid default gen_random_uuid() not null
primary key,
group_id uuid not null
references groups
on delete cascade,
tribe_id bigint not null,
created_at timestamp with time zone default CURRENT_TIMESTAMP not null,
unique (group_id, tribe_id)
);
-- +goose Down
DROP TABLE IF EXISTS groups, monitors;