-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
93 changed files
with
2,767 additions
and
2,346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,48 @@ | ||
-- This file is autogenerated from regen-schema.ts | ||
|
||
CREATE TABLE IF NOT EXISTS answers ( | ||
color text, | ||
contract_id text, | ||
created_time timestamp with time zone DEFAULT now(), | ||
id text PRIMARY KEY DEFAULT random_alphanumeric(12) NOT NULL, | ||
index integer, | ||
is_other boolean DEFAULT false NOT NULL, | ||
pool_no numeric, | ||
pool_yes numeric, | ||
prob numeric, | ||
prob_change_day numeric DEFAULT 0, | ||
prob_change_month numeric DEFAULT 0, | ||
prob_change_week numeric DEFAULT 0, | ||
resolution text, | ||
resolution_probability numeric, | ||
resolution_time timestamp with time zone, | ||
resolver_id text, | ||
subsidy_pool numeric DEFAULT 0, | ||
text text, | ||
text_fts tsvector GENERATED ALWAYS AS (to_tsvector('english_extended'::regconfig, text)) STORED, | ||
total_liquidity numeric DEFAULT 0, | ||
user_id text | ||
); | ||
|
||
|
||
create table if not exists | ||
answers ( | ||
color text, | ||
contract_id text, | ||
created_time timestamp with time zone default now(), | ||
id text primary key default random_alphanumeric (12) not null, | ||
index integer, | ||
is_other boolean default false not null, | ||
pool_no numeric, | ||
pool_yes numeric, | ||
prob numeric, | ||
prob_change_day numeric default 0, | ||
prob_change_month numeric default 0, | ||
prob_change_week numeric default 0, | ||
resolution text, | ||
resolution_probability numeric, | ||
resolution_time timestamp with time zone, | ||
resolver_id text, | ||
subsidy_pool numeric default 0, | ||
text text, | ||
text_fts tsvector generated always as (to_tsvector('english_extended'::regconfig, text)) stored, | ||
total_liquidity numeric default 0, | ||
user_id text | ||
); | ||
|
||
-- Row Level Security | ||
ALTER TABLE answers ENABLE ROW LEVEL SECURITY; | ||
alter table answers enable row level security; | ||
|
||
-- Policies | ||
DROP POLICY IF EXISTS "public read" ON answers; | ||
CREATE POLICY "public read" ON answers FOR SELECT USING (true) ; | ||
drop policy if exists "public read" on answers; | ||
|
||
create policy "public read" on answers for | ||
select | ||
using (true); | ||
|
||
-- Indexes | ||
DROP INDEX IF EXISTS answer_contract_id; | ||
CREATE INDEX answer_contract_id ON public.answers USING btree (contract_id); | ||
DROP INDEX IF EXISTS answer_text_fts; | ||
CREATE INDEX answer_text_fts ON public.answers USING gin (text_fts); | ||
DROP INDEX IF EXISTS answers_pkey; | ||
CREATE UNIQUE INDEX answers_pkey ON public.answers USING btree (id); | ||
drop index if exists answer_contract_id; | ||
|
||
create index answer_contract_id on public.answers using btree (contract_id); | ||
|
||
drop index if exists answer_text_fts; | ||
|
||
create index answer_text_fts on public.answers using gin (text_fts); | ||
|
||
drop index if exists answers_pkey; | ||
|
||
create unique index answers_pkey on public.answers using btree (id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
-- This file is autogenerated from regen-schema.ts | ||
|
||
CREATE TABLE IF NOT EXISTS audit_events ( | ||
comment_id text, | ||
contract_id text, | ||
created_time timestamp with time zone DEFAULT now() NOT NULL, | ||
data jsonb, | ||
id bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY NOT NULL, | ||
name text NOT NULL, | ||
user_id text NOT NULL | ||
); | ||
|
||
|
||
create table if not exists | ||
audit_events ( | ||
comment_id text, | ||
contract_id text, | ||
created_time timestamp with time zone default now() not null, | ||
data jsonb, | ||
id bigint primary key generated always as identity not null, | ||
name text not null, | ||
user_id text not null | ||
); | ||
|
||
-- Row Level Security | ||
ALTER TABLE audit_events ENABLE ROW LEVEL SECURITY; | ||
alter table audit_events enable row level security; | ||
|
||
-- Policies | ||
DROP POLICY IF EXISTS "public read" ON audit_events; | ||
CREATE POLICY "public read" ON audit_events FOR SELECT USING (true) ; | ||
drop policy if exists "public read" on audit_events; | ||
|
||
create policy "public read" on audit_events for | ||
select | ||
using (true); | ||
|
||
-- Indexes | ||
DROP INDEX IF EXISTS audit_events_pkey; | ||
CREATE UNIQUE INDEX audit_events_pkey ON public.audit_events USING btree (id); | ||
drop index if exists audit_events_pkey; | ||
|
||
create unique index audit_events_pkey on public.audit_events using btree (id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,43 @@ | ||
-- This file is autogenerated from regen-schema.ts | ||
|
||
CREATE TABLE IF NOT EXISTS chart_annotations ( | ||
answer_id text, | ||
comment_id text, | ||
contract_id text NOT NULL, | ||
created_time timestamp with time zone DEFAULT now() NOT NULL, | ||
creator_avatar_url text NOT NULL, | ||
creator_id text NOT NULL, | ||
creator_name text NOT NULL, | ||
creator_username text NOT NULL, | ||
down_votes integer DEFAULT 0 NOT NULL, | ||
event_time bigint NOT NULL, | ||
external_url text, | ||
id bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY NOT NULL, | ||
prob_change numeric CONSTRAINT chart_annotations_prob_change_check CHECK (((prob_change >= ('-1'::integer)::numeric) AND (prob_change <= (1)::numeric))), | ||
text text, | ||
thumbnail_url text, | ||
up_votes integer DEFAULT 0 NOT NULL, | ||
user_id text | ||
); | ||
|
||
|
||
create table if not exists | ||
chart_annotations ( | ||
answer_id text, | ||
comment_id text, | ||
contract_id text not null, | ||
created_time timestamp with time zone default now() not null, | ||
creator_avatar_url text not null, | ||
creator_id text not null, | ||
creator_name text not null, | ||
creator_username text not null, | ||
down_votes integer default 0 not null, | ||
event_time bigint not null, | ||
external_url text, | ||
id bigint primary key generated always as identity not null, | ||
prob_change numeric constraint chart_annotations_prob_change_check check ( | ||
( | ||
(prob_change >= ('-1'::integer)::numeric) | ||
and (prob_change <= (1)::numeric) | ||
) | ||
), | ||
text text, | ||
thumbnail_url text, | ||
up_votes integer default 0 not null, | ||
user_id text | ||
); | ||
|
||
-- Row Level Security | ||
ALTER TABLE chart_annotations ENABLE ROW LEVEL SECURITY; | ||
alter table chart_annotations enable row level security; | ||
|
||
-- Policies | ||
DROP POLICY IF EXISTS "public read" ON chart_annotations; | ||
CREATE POLICY "public read" ON chart_annotations FOR ALL USING (true) ; | ||
drop policy if exists "public read" on chart_annotations; | ||
|
||
create policy "public read" on chart_annotations for all using (true); | ||
|
||
-- Indexes | ||
DROP INDEX IF EXISTS chart_annotations_pkey; | ||
CREATE UNIQUE INDEX chart_annotations_pkey ON public.chart_annotations USING btree (id); | ||
DROP INDEX IF EXISTS contract_annotations_event_time; | ||
CREATE INDEX contract_annotations_event_time ON public.chart_annotations USING btree (contract_id, event_time); | ||
drop index if exists chart_annotations_pkey; | ||
|
||
create unique index chart_annotations_pkey on public.chart_annotations using btree (id); | ||
|
||
drop index if exists contract_annotations_event_time; | ||
|
||
create index contract_annotations_event_time on public.chart_annotations using btree (contract_id, event_time); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- This file is autogenerated from regen-schema.ts | ||
create table if not exists | ||
chat_messages ( | ||
channel_id text not null, | ||
content jsonb not null, | ||
created_time timestamp with time zone default now() not null, | ||
id serial not null, | ||
user_id text not null | ||
); | ||
|
||
-- Row Level Security | ||
alter table chat_messages enable row level security; | ||
|
||
-- Policies | ||
drop policy if exists "public read" on chat_messages; | ||
|
||
create policy "public read" on chat_messages for | ||
select | ||
using (true); | ||
|
||
-- Indexes | ||
drop index if exists chat_messages_channel_id; | ||
|
||
create index chat_messages_channel_id on public.chat_messages using btree (channel_id, id desc); | ||
|
||
drop index if exists chat_messages_pkey; | ||
|
||
create unique index chat_messages_pkey on public.chat_messages using btree (id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.