From 9c7d769afcd8c1f89b53d9af9d8a737609e63026 Mon Sep 17 00:00:00 2001 From: GroovieGermanikus Date: Thu, 8 Feb 2024 08:02:03 +0100 Subject: [PATCH] BREAKING: make transaction_id the primary key in transactions lookup table --- migration.sql | 10 +++++----- src/postgres.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/migration.sql b/migration.sql index d881848..8298999 100644 --- a/migration.sql +++ b/migration.sql @@ -1,9 +1,9 @@ CREATE SCHEMA banking_stage_results_2; CREATE TABLE banking_stage_results_2.transactions( - signature char(88) primary key, - transaction_id bigserial, - UNIQUE(transaction_id) + transaction_id bigserial PRIMARY KEY, + signature varchar(88) NOT NULL, + UNIQUE(signature) ); CREATE TABLE banking_stage_results_2.transaction_infos ( @@ -46,8 +46,8 @@ CREATE TABLE banking_stage_results_2.blocks ( ); CREATE TABLE banking_stage_results_2.accounts( - acc_id bigserial primary key, - account_key char(44), + acc_id bigserial PRIMARY KEY, + account_key varchar(44) NOT NULL, UNIQUE (account_key) ); diff --git a/src/postgres.rs b/src/postgres.rs index 7b527c6..fc546c1 100644 --- a/src/postgres.rs +++ b/src/postgres.rs @@ -235,7 +235,7 @@ impl PostgresSession { let statement = format!( r#" INSERT INTO banking_stage_results_2.transactions(signature) SELECT signature from {} - ON CONFLICT DO NOTHING + ON CONFLICT(signature) DO NOTHING "#, temp_table ); @@ -296,7 +296,7 @@ impl PostgresSession { let statement = format!( r#" INSERT INTO banking_stage_results_2.accounts(account_key) SELECT key from {} - ON CONFLICT DO NOTHING + ON CONFLICT(account_key) DO NOTHING "#, temp_table );