首次使用需先在 Supabase 执行建表 SQL(SQL Editor → New query → 粘贴运行,只需执行一次):
-- Luca ISO TMS 云同步建表(可重复执行)
create table if not exists public.ehs_sync (
code text primary key,
payload jsonb,
updated_at timestamptz not null default now()
);
alter table public.ehs_sync enable row level security;
drop policy if exists "ehs_sync_anon_all" on public.ehs_sync;
create policy "ehs_sync_anon_all" on public.ehs_sync
for all to anon using (true) with check (true);
-- 新版 Supabase 默认不给新表授权,缺这两行会报 401/403
grant usage on schema public to anon;
grant select, insert, update, delete on table public.ehs_sync to anon;