add "NOT NULL" constraint wherever possible

This commit is contained in:
GroovieGermanikus 2024-02-08 08:32:43 +01:00
parent 8fa88d7377
commit b33925e2b3
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
2 changed files with 47 additions and 47 deletions

View File

@ -8,11 +8,11 @@ CREATE TABLE banking_stage_results_2.transactions(
CREATE TABLE banking_stage_results_2.transaction_infos (
transaction_id BIGINT PRIMARY KEY,
processed_slot BIGINT,
is_successful BOOL,
cu_requested BIGINT,
cu_consumed BIGINT,
prioritization_fees BIGINT,
processed_slot BIGINT NOT NULL,
is_successful BOOL NOT NULL,
cu_requested BIGINT NOT NULL,
cu_consumed BIGINT NOT NULL,
prioritization_fees BIGINT NOT NULL,
supp_infos text
);
@ -24,8 +24,8 @@ CREATE TABLE banking_stage_results_2.errors (
CREATE TABLE banking_stage_results_2.transaction_slot (
transaction_id BIGINT,
slot BIGINT,
error_code INT,
count INT,
error_code INT NOT NULL,
count INT NOT NULL,
utc_timestamp TIMESTAMP NOT NULL,
PRIMARY KEY (transaction_id, slot, error_code)
);
@ -36,12 +36,12 @@ CREATE INDEX idx_transaction_slot_slot ON banking_stage_results_2.transaction_sl
CREATE TABLE banking_stage_results_2.blocks (
slot BIGINT PRIMARY KEY,
block_hash char(44),
leader_identity char(44),
successful_transactions BIGINT,
processed_transactions BIGINT,
total_cu_used BIGINT,
total_cu_requested BIGINT,
block_hash varchar(44),
leader_identity varchar(44) NOT NULL,
successful_transactions BIGINT NOT NULL,
processed_transactions BIGINT NOT NULL,
total_cu_used BIGINT NOT NULL,
total_cu_requested BIGINT NOT NULL,
supp_infos text
);
@ -52,23 +52,23 @@ CREATE TABLE banking_stage_results_2.accounts(
);
CREATE TABLE banking_stage_results_2.accounts_map_transaction(
acc_id BIGINT,
transaction_id BIGINT,
is_writable BOOL,
is_signer BOOL,
is_atl BOOL,
transaction_id BIGINT NOT NULL,
acc_id BIGINT NOT NULL,
is_writable BOOL NOT NULL,
is_signer BOOL NOT NULL,
is_atl BOOL NOT NULL,
PRIMARY KEY (transaction_id, acc_id)
);
CREATE INDEX idx_blocks_block_hash ON banking_stage_results_2.blocks(block_hash);
CREATE TABLE banking_stage_results_2.accounts_map_blocks (
acc_id BIGINT,
slot BIGINT,
is_write_locked BOOL,
total_cu_consumed BIGINT,
total_cu_requested BIGINT,
prioritization_fees_info text,
acc_id BIGINT NOT NULL,
slot BIGINT NOT NULL,
is_write_locked BOOL NOT NULL,
total_cu_consumed BIGINT NOT NULL,
total_cu_requested BIGINT NOT NULL,
prioritization_fees_info text NOT NULL,
supp_infos text,
PRIMARY KEY (acc_id, slot, is_write_locked)
);

View File

@ -200,7 +200,7 @@ impl PostgresSession {
format!(
r#"
CREATE TEMP TABLE {}(
signature varchar(88)
signature varchar(88) NOT NULL
);
"#,
temp_table
@ -262,7 +262,7 @@ impl PostgresSession {
.execute(
format!(
"CREATE TEMP TABLE {}(
key TEXT
key TEXT NOT NULL
);",
temp_table
)
@ -322,11 +322,11 @@ impl PostgresSession {
.execute(
format!(
"CREATE TEMP TABLE {}(
sig varchar(88),
slot BIGINT,
error_code INT,
count INT,
utc_timestamp TIMESTAMP
sig varchar(88) NOT NULL,
slot BIGINT NOT NULL,
error_code INT NOT NULL,
count INT NOT NULL,
utc_timestamp TIMESTAMP NOT NULL
);",
temp_table
)
@ -414,11 +414,11 @@ impl PostgresSession {
.execute(
format!(
"CREATE TEMP TABLE {}(
account_key varchar(44),
signature varchar(88),
is_writable BOOL,
is_signer BOOL,
is_atl BOOL
account_key varchar(44) NOT NULL,
signature varchar(88) NOT NULL,
is_writable BOOL NOT NULL,
is_signer BOOL NOT NULL,
is_atl BOOL NOT NULL
);",
temp_table
)
@ -551,12 +551,12 @@ impl PostgresSession {
.execute(
format!(
"CREATE TEMP TABLE {}(
signature varchar(88),
processed_slot BIGINT,
is_successful BOOL,
cu_requested BIGINT,
cu_consumed BIGINT,
prioritization_fees BIGINT,
signature varchar(88) NOT NULL,
processed_slot BIGINT NOT NULL,
is_successful BOOL NOT NULL,
cu_requested BIGINT NOT NULL,
cu_consumed BIGINT NOT NULL,
prioritization_fees BIGINT NOT NULL,
supp_infos text
)",
temp_table
@ -648,11 +648,11 @@ impl PostgresSession {
.execute(
format!(
"CREATE TEMP TABLE {}(
account_key varchar(44),
slot BIGINT,
is_write_locked BOOL,
total_cu_requested BIGINT,
total_cu_consumed BIGINT,
account_key varchar(44) NOT NULL,
slot BIGINT NOT NULL,
is_write_locked BOOL NOT NULL,
total_cu_requested BIGINT NOT NULL,
total_cu_consumed BIGINT NOT NULL,
prioritization_fees_info text
)",
temp_table