-- v35: store the linked Discord account's Nitro tier for its official profile badge.
alter table public.profiles
  add column if not exists discord_premium_type smallint not null default 0;

do $$
begin
  if not exists (
    select 1 from pg_constraint
    where conname = 'profiles_discord_premium_type_range'
  ) then
    alter table public.profiles
      add constraint profiles_discord_premium_type_range
      check (discord_premium_type between 0 and 3);
  end if;
end $$;