Spaces:
Running
Running
Download app/projects/migrations/0013_notification_preferences.sql from basyx/MediaRouter: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/basyx/MediaRouter/resolve/main/app/projects/migrations/0013_notification_preferences.sql
- Command line
-
hf download hf://spaces/basyx/MediaRouter/app/projects/migrations/0013_notification_preferences.sql
-
curl -L -o 0013_notification_preferences.sql https://huggingface.co/spaces/basyx/MediaRouter/resolve/main/app/projects/migrations/0013_notification_preferences.sql
1.06 kB
| begin; | |
| -- Notification Preferences | |
| create table if not exists notification_preferences ( | |
| id text primary key, | |
| workspace_id text not null references workspaces(id) on delete cascade, | |
| user_id text not null references users(id) on delete cascade, | |
| event_type varchar(50) not null check (event_type in ( | |
| 'collaboration_event', 'approval_request', 'publishing_failure', 'mention', 'project_activity' | |
| )), | |
| enabled boolean not null default true, | |
| created_at timestamptz not null default now(), | |
| unique(workspace_id, user_id, event_type) | |
| ); | |
| create index ix_notification_preferences_workspace_user on notification_preferences(workspace_id, user_id); | |
| -- RLS | |
| alter table notification_preferences enable row level security; | |
| alter table notification_preferences force row level security; | |
| create policy notification_preferences_workspace_isolation on notification_preferences | |
| using (workspace_id = current_setting('app.workspace_id', true)) | |
| with check (workspace_id = current_setting('app.workspace_id', true)); | |
| commit; | |