2023-05-09 15:45:31 -07:00
|
|
|
-- 2023-05-09: Add pride flags
|
|
|
|
-- Hashes are a separate table so we can deduplicate flags.
|
|
|
|
|
2023-08-15 18:30:34 -07:00
|
|
|
-- +migrate Up
|
|
|
|
|
2023-05-09 15:45:31 -07:00
|
|
|
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
|
|
|
|
);
|
2023-08-15 18:30:34 -07:00
|
|
|
|
|
|
|
-- +migrate Down
|
|
|
|
|
|
|
|
drop table member_flags;
|
|
|
|
drop table user_flags;
|
|
|
|
drop table pride_flags;
|