create table if not exists items (
id text primary key,
title text not null,
kind text default 'task',
start_at timestamp,
end_at timestamp,
due_at timestamp,
all_day boolean default true,
person text,
area text default 'work',
list_name text,
location text,
notes text,
done boolean default false,
created_at timestamp default now(),
updated_at timestamp default now()
);
-- 如果表已经建过,补上新增的列
alter table items add column if not exists due_at timestamp;
alter table items add column if not exists area text default 'work';
alter table items enable row level security;
create policy "personal all access" on items
for all using (true) with check (true);