predikt/oracle/backend/supabase/user_events.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

45 lines
1.1 KiB
SQL

-- This file is autogenerated from regen-schema.ts
create table if not exists
user_events (
ad_id text,
comment_id text,
contract_id text,
data jsonb not null,
id bigint primary key generated always as identity not null,
name text not null,
ts timestamp with time zone default now() not null,
user_id text
);
-- Row Level Security
alter table user_events enable row level security;
-- Policies
drop policy if exists "self and admin read" on user_events;
create policy "self and admin read" on user_events for
select
using (
(
(user_id = firebase_uid ())
or is_admin (firebase_uid ())
)
);
drop policy if exists "user can insert" on user_events;
drop policy if exists "user can insert own events" on user_events;
create policy "user can insert own events" on user_events for insert
with
check ((user_id is not distinct from firebase_uid ()));
-- Indexes
drop index if exists user_events_pkey;
create unique index user_events_pkey on public.user_events using btree (id);
drop index if exists user_events_ts;
create index user_events_ts on public.user_events using btree (ts desc);