Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- Create notifications table
create table if not exists public.notifications (
id uuid primary key default gen_random_uuid(),
user_id text not null references public.users(id) on delete cascade,
type text not null,
title text not null,
body text not null,
data jsonb,
read_at timestamptz,
is_archived boolean not null default false,
archived_at timestamptz,
created_at timestamptz default now()
);

create index if not exists idx_notifications_user_id_created_at
on public.notifications (user_id, created_at desc)
where is_archived = false;

-- Enable RLS
alter table public.notifications enable row level security;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Create device_tokens table for mobile push notifications
create table if not exists public.device_tokens (
id uuid primary key default gen_random_uuid(),
user_id text not null references public.users(id) on delete cascade,
token text not null,
platform text not null, -- 'ios' | 'android'
created_at timestamptz default now(),
unique (user_id, token)
);

-- Enable RLS
alter table public.device_tokens enable row level security;
Loading