① 建表脚本(只需运行一次)
登录 Supabase → 左侧 SQL Editor → New query → 把下面整段粘进去 → 点右下角 Run。
看到绿色的 Success. No rows returned 就成了。 之前已经建过表的:再跑一次也不会动你已有的数据,只会补一张存密码和提醒设置的 app_settings 表。
create table if not exists health_records (
id bigint generated always as identity primary key,
who text not null default '程先生',
date date not null,
weight numeric, sbp integer, dbp integer,
hr integer, spo2 integer, temp numeric,
sleep_time time, wake_time time, sleep_quality smallint,
palp smallint, orthopnea smallint, edema smallint, dyspnea smallint,
resp smallint, gi smallint, med smallint,
note text,
created_at timestamptz default now(),
unique (who, date)
);
alter table health_records enable row level security;
drop policy if exists "family_all" on health_records;
create policy "family_all" on health_records for all to anon using (true) with check (true);
create table if not exists app_settings (
k text primary key,
v text,
updated_at timestamptz default now()
);
alter table app_settings enable row level security;
drop policy if exists "settings_all" on app_settings;
create policy "settings_all" on app_settings for all to anon using (true) with check (true);