2023-03-19 08:14:09 -07:00
|
|
|
-- 2023-03-19: Add moderation-related tables
|
|
|
|
|
2023-08-15 18:30:34 -07:00
|
|
|
-- +migrate Up
|
|
|
|
|
2023-03-19 08:14:09 -07:00
|
|
|
alter table users add column is_admin boolean not null default false;
|
|
|
|
|
|
|
|
create table reports (
|
|
|
|
id serial primary key,
|
|
|
|
-- we keep deleted users for 180 days after deletion, so it's fine to tie this to a user object
|
|
|
|
user_id text not null references users (id) on delete cascade,
|
|
|
|
member_id text null references members (id) on delete set null,
|
|
|
|
reason text not null,
|
|
|
|
reporter_id text not null,
|
|
|
|
|
|
|
|
created_at timestamptz not null default now(),
|
|
|
|
resolved_at timestamptz,
|
|
|
|
admin_id text null references users (id) on delete set null,
|
|
|
|
admin_comment text
|
|
|
|
);
|
2023-03-23 06:54:43 -07:00
|
|
|
|
|
|
|
create table warnings (
|
|
|
|
id serial primary key,
|
|
|
|
user_id text not null references users (id) on delete cascade,
|
|
|
|
reason text not null,
|
|
|
|
created_at timestamptz not null default now(),
|
|
|
|
read_at timestamptz
|
|
|
|
);
|
2023-08-15 18:30:34 -07:00
|
|
|
|
|
|
|
-- +migrate Down
|
|
|
|
|
|
|
|
drop table warnings;
|
|
|
|
drop table reports;
|
|
|
|
alter table users drop column is_admin;
|