-- Fix notifications type check to allow new follow-related types

do $$
begin
  if exists (
    select 1
    from pg_constraint
    where conname = 'notifications_type_check'
  ) then
    alter table notifications
      drop constraint notifications_type_check;
  end if;
end $$;

alter table notifications
  add constraint notifications_type_check
  check (type in (
    'appreciate',
    'chain',
    'follow',
    'comment',
    'mention',
    'follow_request',
    'new_follower',
    'request_accepted'
  ));
