-- Create Expense Categories Table create table expense_categories ( id uuid default uuid_generate_v4() primary key, name text not null, description text, created_at timestamp with time zone default timezone('utc'::text, now()) not null ); -- Create Expenses Table create table expenses ( id uuid default uuid_generate_v4() primary key, category_id uuid references expense_categories(id) on delete set null, amount decimal(10,2) not null, description text, date timestamp with time zone default timezone('utc'::text, now()) not null, created_by uuid references auth.users(id), created_at timestamp with time zone default timezone('utc'::text, now()) not null ); -- RLS alter table expense_categories enable row level security; alter table expenses enable row level security; create policy "Enable all access for authenticated users" on expense_categories for all using (auth.role() = 'authenticated'); create policy "Enable all access for authenticated users" on expenses for all using (auth.role() = 'authenticated');