连接云端后,你的记录会实时写入数据库,别人打开链接刷新即可看到最新内容。
Supabase 后台 → SQL Editor → New query → 粘贴运行。首次建表和老表升级用的是同一段。
create table if not exists calendar_days (
date text primary key,
content text default '',
items jsonb default '[]'::jsonb,
imgs jsonb default '[]'::jsonb,
updated_at timestamptz default now()
);
alter table calendar_days add column if not exists items jsonb default '[]'::jsonb;
alter table calendar_days add column if not exists imgs jsonb default '[]'::jsonb;
alter table calendar_days enable row level security;
drop policy if exists "public rw" on calendar_days;
create policy "public rw" on calendar_days
for all to anon using (true) with check (true);
-- 图片 storage(可选,配了 bucket 才用到)
insert into storage.buckets (id, name, public)
values ('images','images',true) on conflict (id) do nothing;
drop policy if exists "public images" on storage.objects;
create policy "public images" on storage.objects
for all to anon using (bucket_id='images') with check (bucket_id='images');
链接里会自动带上云端配置,对方打开就能看到内容。只读链接对方看得到但改不了。
建议定期导出备份,浏览器清缓存会丢失本地数据。