sojorn/_legacy/supabase/migrations/20260114_add_profile_role.sql
2026-02-15 00:33:24 -06:00

16 lines
349 B
SQL

alter table profiles
add column if not exists role text not null default 'user';
do $$
begin
if not exists (
select 1
from pg_constraint
where conname = 'profiles_role_check'
) then
alter table profiles
add constraint profiles_role_check
check (role in ('user', 'moderator', 'admin', 'banned'));
end if;
end $$;