pronounsfu/scripts/migrate/017_pride_flags.sql

25 lines
822 B
SQL

-- +migrate Up
-- 2023-05-09: Add pride flags
-- Hashes are a separate table so we can deduplicate flags.
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
);