19 lines
497 B
SQL
19 lines
497 B
SQL
alter table profiles
|
|
add column if not exists strikes integer not null default 0;
|
|
|
|
alter table posts
|
|
add column if not exists moderation_status text not null default 'approved';
|
|
|
|
do $$
|
|
begin
|
|
if not exists (
|
|
select 1
|
|
from pg_constraint
|
|
where conname = 'posts_moderation_status_check'
|
|
) then
|
|
alter table posts
|
|
add constraint posts_moderation_status_check
|
|
check (moderation_status in ('approved', 'flagged_bigotry', 'flagged_nsfw', 'rejected'));
|
|
end if;
|
|
end $$;
|