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>
69 lines
2.0 KiB
SQL
69 lines
2.0 KiB
SQL
-- This file is autogenerated from regen-schema.ts
|
|
create table if not exists
|
|
users (
|
|
balance numeric default 0 not null,
|
|
cash_balance numeric default 0 not null,
|
|
created_time timestamp with time zone default now() not null,
|
|
data jsonb not null,
|
|
id text primary key default random_alphanumeric (12) not null,
|
|
last_free_loan_claim timestamp with time zone,
|
|
name text not null,
|
|
name_username_vector tsvector generated always as (
|
|
to_tsvector(
|
|
'english'::regconfig,
|
|
(name || ' '::text) || username
|
|
)
|
|
) stored,
|
|
resolved_profit_adjustment numeric,
|
|
spice_balance numeric default 0 not null,
|
|
total_cash_deposits numeric default 0 not null,
|
|
total_deposits numeric default 0 not null,
|
|
username text not null,
|
|
unban_time timestamp with time zone
|
|
);
|
|
|
|
-- Row Level Security
|
|
alter table users enable row level security;
|
|
|
|
-- Policies
|
|
drop policy if exists "public read" on users;
|
|
|
|
create policy "public read" on users for
|
|
select
|
|
using (true);
|
|
|
|
-- Indexes
|
|
drop index if exists user_referrals_idx;
|
|
|
|
create index user_referrals_idx on public.users using btree (((data ->> 'referredByUserId'::text)))
|
|
where
|
|
((data ->> 'referredByUserId'::text) is not null);
|
|
|
|
drop index if exists user_username_idx;
|
|
|
|
create index user_username_idx on public.users using btree (username);
|
|
|
|
drop index if exists users_betting_streak_idx;
|
|
|
|
create index users_betting_streak_idx on public.users using btree (
|
|
(((data -> 'currentBettingStreak'::text))::integer)
|
|
);
|
|
|
|
drop index if exists users_created_time;
|
|
|
|
create index users_created_time on public.users using btree (created_time desc);
|
|
|
|
drop index if exists users_name_idx;
|
|
|
|
create index users_name_idx on public.users using btree (name);
|
|
|
|
drop index if exists users_pkey;
|
|
|
|
create unique index users_pkey on public.users using btree (id);
|
|
|
|
drop index if exists users_unban_time_idx;
|
|
|
|
create index users_unban_time_idx on public.users using btree (unban_time)
|
|
where
|
|
(unban_time is not null);
|