predikt/oracle/backend/supabase/user_notifications.sql
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

37 lines
1.1 KiB
SQL

-- This file is autogenerated from regen-schema.ts
create table if not exists
user_notifications (
data jsonb not null,
notification_id text not null,
user_id text not null,
primary key (user_id, notification_id)
);
-- Row Level Security
alter table user_notifications enable row level security;
-- Policies
drop policy if exists "self read" on user_notifications;
create policy "self read" on user_notifications for
select
using ((user_id = firebase_uid ()));
-- Indexes
drop index if exists user_notifications_notification_id;
create index user_notifications_notification_id on public.user_notifications using btree (notification_id, user_id);
drop index if exists user_notifications_pkey;
create unique index user_notifications_pkey on public.user_notifications using btree (user_id, notification_id);
drop index if exists user_notifications_user_id_read_created;
create index user_notifications_user_id_read_created on public.user_notifications using btree (
user_id,
(((data ->> 'markedAsRead'::text))::boolean),
(((data -> 'createdTime'::text))::bigint) desc
);