This commit is contained in:
2026-04-02 14:29:36 +02:00
parent a270deb2db
commit 039fa0bc80
54 changed files with 4944 additions and 170 deletions

View File

@@ -0,0 +1,25 @@
-- Category type enum
create type category_type as enum (
'income', 'bill', 'variable_expense', 'debt', 'saving', 'investment'
);
-- Categories table
create table categories (
id uuid primary key default gen_random_uuid(),
user_id uuid not null references auth.users(id) on delete cascade,
name text not null,
type category_type not null,
icon text,
sort_order int not null default 0,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index categories_user_id_idx on categories(user_id);
alter table categories enable row level security;
create policy "Users can CRUD own categories"
on categories for all
using (user_id = auth.uid())
with check (user_id = auth.uid());