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>
74 lines
1.8 KiB
PL/PgSQL
74 lines
1.8 KiB
PL/PgSQL
-- noinspection SqlNoDataSourceInspectionForFile
|
|
/* *************************************************************** */
|
|
/* 0. database-wide configuration */
|
|
/* *************************************************************** */
|
|
/* allow our backend and CLI users to have a long statement timeout */
|
|
alter role postgres
|
|
set
|
|
statement_timeout = 0;
|
|
|
|
alter role service_role
|
|
set
|
|
statement_timeout = '1h';
|
|
|
|
/* multi-column GIN indexes */
|
|
create extension if not exists btree_gin;
|
|
|
|
/* for fancy machine learning stuff */
|
|
create extension if not exists vector;
|
|
|
|
/* GIN trigram indexes */
|
|
create extension if not exists pg_trgm;
|
|
|
|
/* for UUID generation */
|
|
create extension if not exists pgcrypto;
|
|
|
|
/* for accent-insensitive search */
|
|
create extension if not exists unaccent;
|
|
|
|
/* enable `explain` via the HTTP API for convenience */
|
|
alter role authenticator
|
|
set
|
|
pgrst.db_plan_enabled to true;
|
|
|
|
notify pgrst,
|
|
'reload config';
|
|
|
|
/* create a version of to_jsonb marked immutable so that we can index over it.
|
|
see https://github.com/PostgREST/postgrest/issues/2594 */
|
|
create
|
|
or replace function to_jsonb(jsonb) returns jsonb immutable parallel safe strict language sql as $$
|
|
select $1
|
|
$$;
|
|
|
|
create text search dictionary english_stem_nostop (template = snowball, language = english);
|
|
|
|
create text search dictionary english_prefix (template = simple);
|
|
|
|
create text search configuration public.english_nostop_with_prefix (
|
|
copy = english
|
|
);
|
|
|
|
alter text search configuration public.english_nostop_with_prefix
|
|
alter mapping for asciiword,
|
|
asciihword,
|
|
hword_asciipart,
|
|
hword,
|
|
hword_part,
|
|
word
|
|
with
|
|
unaccent,
|
|
english_stem_nostop,
|
|
english_prefix;
|
|
|
|
create text search configuration public.english_extended (
|
|
copy = english
|
|
);
|
|
|
|
alter text search configuration public.english_extended
|
|
alter mapping for hword,
|
|
hword_part,
|
|
word
|
|
with
|
|
unaccent;
|