31 lines
913 B
SQL
31 lines
913 B
SQL
-- 2023-05-09: Add pride flags
|
|
-- Hashes are a separate table so we can deduplicate flags.
|
|
|
|
-- +migrate Up
|
|
|
|
create table pride_flags (
|
|
id text primary key,
|
|
user_id text not null references users (id) on delete cascade,
|
|
hash text not null,
|
|
name text not null,
|
|
description text
|
|
);
|
|
|
|
create table user_flags (
|
|
id bigint generated by default as identity primary key,
|
|
user_id text not null references users (id) on delete cascade,
|
|
flag_id text not null references pride_flags (id) on delete cascade
|
|
);
|
|
|
|
create table member_flags (
|
|
id bigint generated by default as identity primary key,
|
|
member_id text not null references members (id) on delete cascade,
|
|
flag_id text not null references pride_flags (id) on delete cascade
|
|
);
|
|
|
|
-- +migrate Down
|
|
|
|
drop table member_flags;
|
|
drop table user_flags;
|
|
drop table pride_flags;
|