sum
This commit is contained in:
25
supabase/migrations/002_categories.sql
Normal file
25
supabase/migrations/002_categories.sql
Normal 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());
|
||||
Reference in New Issue
Block a user