Merge pull request #120 from blockworks-foundation/postgres_test_migration_fix
postgres migration and test script fix
This commit is contained in:
commit
65c5d8365c
|
@ -16,9 +16,9 @@ CREATE TABLE lite_rpc.Txs (
|
|||
CREATE TABLE lite_rpc.Blocks (
|
||||
slot BIGINT NOT NULL PRIMARY KEY,
|
||||
leader_id BIGINT NOT NULL,
|
||||
parent_slot BIGINT NOT NULL
|
||||
parent_slot BIGINT NOT NULL,
|
||||
cluster_time TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
local_time TIMESTAMP WITH TIME ZONE,
|
||||
local_time TIMESTAMP WITH TIME ZONE
|
||||
);
|
||||
|
||||
CREATE TABLE lite_rpc.AccountAddrs (
|
||||
|
|
|
@ -92,7 +92,6 @@ impl PostgresSession {
|
|||
let ca_pem = BinaryEncoding::Base64
|
||||
.decode(ca_pem_b64)
|
||||
.context("ca pem decode")?;
|
||||
|
||||
let client_pks = BinaryEncoding::Base64
|
||||
.decode(client_pks_b64)
|
||||
.context("client pks decode")?;
|
||||
|
@ -346,13 +345,13 @@ impl Postgres {
|
|||
);
|
||||
|
||||
if let Err(err) = res_txs {
|
||||
warn!("Error sending tx batch to postgres {err:?}");
|
||||
warn!("Error sending tx batch ({:?}) to postgres {err:?}", tx_que.len());
|
||||
} else {
|
||||
tx_que.clear();
|
||||
}
|
||||
|
||||
if let Err(err) = res_block {
|
||||
warn!("Error sending block batch to postgres {err:?}");
|
||||
warn!("Error sending block batch ({:?}) to postgres {err:?}", block_que.len());
|
||||
} else {
|
||||
block_que.clear();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# kill background jobs on exit/failure
|
||||
trap 'kill $(jobs -pr)' SIGINT SIGTERM EXIT
|
||||
|
||||
# env variables
|
||||
export PGPASSWORD="password"
|
||||
export PG_CONFIG="host=localhost dbname=postgres user=postgres password=password sslmode=disable"
|
||||
|
@ -16,6 +19,12 @@ docker start test-postgres
|
|||
echo "Clearing database"
|
||||
pg_run -f ../migrations/rm.sql
|
||||
pg_run -f ../migrations/create.sql
|
||||
|
||||
echo "Starting the test validator"
|
||||
solana-test-validator > /dev/null &
|
||||
|
||||
echo "Waiting 8 seconds for solana-test-validator to start"
|
||||
sleep 8
|
||||
|
||||
echo "Starting lite-rpc"
|
||||
cargo run --release -- -p &
|
||||
|
|
Loading…
Reference in New Issue