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>
35 lines
1.1 KiB
SQL
35 lines
1.1 KiB
SQL
-- This file is autogenerated from regen-schema.ts
|
|
create table if not exists
|
|
reviews (
|
|
content jsonb,
|
|
created_time timestamp with time zone default now() not null,
|
|
market_id text not null,
|
|
rating numeric not null,
|
|
reviewer_id text not null,
|
|
vendor_id text not null,
|
|
primary key (reviewer_id, market_id)
|
|
);
|
|
|
|
-- Indexes
|
|
drop index if exists reviews_pkey;
|
|
|
|
create unique index reviews_pkey on public.reviews using btree (reviewer_id, market_id);
|
|
|
|
-- Enable Row Level Security
|
|
alter table reviews enable row level security;
|
|
|
|
-- Policy: Users can only read reviews (public read access)
|
|
create policy "Reviews are publicly readable" on reviews
|
|
for select using (true);
|
|
|
|
-- Policy: Only authenticated users can insert/update their own reviews
|
|
create policy "Users can insert their own reviews" on reviews
|
|
for insert with check (auth.uid()::text = reviewer_id);
|
|
|
|
create policy "Users can update their own reviews" on reviews
|
|
for update using (auth.uid()::text = reviewer_id);
|
|
|
|
-- Policy: No public delete access (only through API with proper checks)
|
|
create policy "No public delete access" on reviews
|
|
for delete using (false);
|