Supabase 数据库建表 SQL (在 SQL Editor 运行一次):
create table bm_records (
id text primary key,
user_id uuid not null default auth.uid() references auth.users(id),
ts bigint not null,
duration bigint,
bristol int,
amount text, color text, smell text, feel text,
symptoms jsonb, mood text, place text, note text,
updated_at bigint not null default (extract(epoch from now())*1000)::bigint
);
alter table bm_records enable row level security;
create policy "owner access" on bm_records for all
using (auth.uid() = user_id) with check (auth.uid() = user_id);