create table if not exists public.ttc_work_log_snapshots (
  sync_id text primary key,
  encrypted_payload text not null,
  schema_version integer not null default 2,
  updated_at timestamptz not null default now()
);

alter table public.ttc_work_log_snapshots enable row level security;

drop policy if exists "ttc snapshots public encrypted read" on public.ttc_work_log_snapshots;
drop policy if exists "ttc snapshots public encrypted insert" on public.ttc_work_log_snapshots;
drop policy if exists "ttc snapshots public encrypted update" on public.ttc_work_log_snapshots;

create policy "ttc snapshots public encrypted read"
on public.ttc_work_log_snapshots
for select
to anon
using (true);

create policy "ttc snapshots public encrypted insert"
on public.ttc_work_log_snapshots
for insert
to anon
with check (true);

create policy "ttc snapshots public encrypted update"
on public.ttc_work_log_snapshots
for update
to anon
using (true)
with check (true);
