Skip to content

Commit 97744dc

Browse files
fix: Update scripts
1 parent f9985c3 commit 97744dc

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

scripts/create_indexes.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# Job to create indexes on dbsync instance.
22
#
3-
# This is difficult to automatize because it has to be ran after the postgres is created
4-
# and dbsync has ran, but before anyone uses it. Here you have to replace the salt and the
5-
# network for it to work.
3+
# This is difficult to automatize because it has to be ran after the postgres
4+
# is created and dbsync has ran, but before anyone uses it. Here you have to
5+
# replace the salt, pgbouncerpassword and the network for it to work.
66
---
77
apiVersion: v1
88
data:
99
indexes.sql: |
1010
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
1111
12+
-- PGBouncer
13+
CREATE ROLE pgbouncer WITH PASSWORD '{pgbouncerpassword}';
14+
ALTER ROLE pgbouncer WITH LOGIN;
15+
CREATE OR REPLACE FUNCTION user_search(uname TEXT) RETURNS TABLE (usename name, passwd text) as
16+
$$
17+
SELECT usename, passwd FROM pg_shadow WHERE usename=uname;
18+
$$
19+
LANGUAGE sql SECURITY DEFINER;
20+
1221
-- dbsync indexes
1322
CREATE UNIQUE INDEX IF NOT EXISTS ada_pots_pkey ON public.ada_pots USING btree (id);
1423
CREATE UNIQUE INDEX IF NOT EXISTS unique_ada_pots ON public.ada_pots USING btree (block_id);
@@ -202,6 +211,8 @@ data:
202211
CREATE INDEX IF NOT EXISTS bf_idx_col_tx_out ON collateral_tx_out USING btree (tx_id);
203212
CREATE INDEX IF NOT EXISTS bf_idx_ma_tx_mint_ident ON ma_tx_mint USING btree (ident);
204213
CREATE INDEX IF NOT EXISTS bf_idx_ma_tx_out_ident ON ma_tx_out USING btree (ident);
214+
215+
ANALYZE VERBOSE;
205216
immutable: false
206217
kind: ConfigMap
207218
metadata:

scripts/grant_read_access.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
export PGSSLMODE=disable
33
export PG_SUPERUSER=postgres
4-
export PGPASSWORD=""
4+
export PGPASSWORD="."
55
export PG_NEW_USER=""
66
export PG_NEW_USER_PASSWORD=""
77
export PGHOST=localhost
@@ -15,7 +15,7 @@ if [ -z "$PG_SUPERUSER" ] || [ -z "$PGPASSWORD" ] || [ -z "$PG_NEW_USER" ] || [
1515
fi
1616

1717
# Target databases
18-
databases=("dbsync-mainnet" "dbsync-preview" "dbsync-preprod")
18+
databases=("dbsync-mainnet" "dbsync-preview" "dbsync-preprod" "dbsync-vector-testnet" "dbsync-prime-testnet")
1919

2020
# Create the new user
2121
echo "Creating user: $PG_NEW_USER"

0 commit comments

Comments
 (0)