Chỉ cần làm một lần. Thông tin được lưu trên trình duyệt của bạn, không gửi đi đâu cả.
create table if not exists entries (
id bigint primary key,
date_key date not null,
type text not null check (type in ('income','expense')),
amount numeric(15,2) not null,
note text not null default '',
cat text not null default '',
created_at timestamptz default now()
);
create index if not exists idx_entries_date on entries(date_key);
create table if not exists plans (
id bigint primary key,
date_key date not null,
name text not null,
budget numeric(15,2) not null,
done boolean not null default false
);
create index if not exists idx_plans_date on plans(date_key);
create table if not exists remind_cfg (
id serial primary key,
cfg_json jsonb not null,
updated_at timestamptz default now()
);
-- Cho phép truy cập không cần đăng nhập (anon key)
alter table entries enable row level security;
alter table plans enable row level security;
alter table remind_cfg enable row level security;
create policy "allow all" on entries for all using (true) with check (true);
create policy "allow all" on plans for all using (true) with check (true);
create policy "allow all" on remind_cfg for all using (true) with check (true);