-- Per-member conversation preferences: archive + mute.
--
-- Both live on `conversation_members` because they are per-user state, not
-- shared across the conversation. Archive hides the conversation from the
-- main list until explicitly unarchived. Mute silences notifications until
-- `muted_until` (null = not muted, a far-future timestamp = muted forever).

alter table public.conversation_members
  add column if not exists archived boolean not null default false,
  add column if not exists muted_until timestamptz null;

-- Update policy on conversation_members already allows self-updates via
-- `members_update_self_or_admin`. No additional policy needed — users can
-- toggle their own archive / mute flags.

-- Realtime publication already includes `conversation_members`.
