diff options
author | Nic Eigel <nic@eigel.ch> | 2024-08-28 21:31:58 +0200 |
---|---|---|
committer | Nic Eigel <nic@eigel.ch> | 2024-08-28 21:31:58 +0200 |
commit | ca41d6a906e63658fafb10056da2630b41229717 (patch) | |
tree | accfa7fd6b6a7e2251e59d2372f8e45831c13832 | |
parent | e3e66616622bc0e329b0cb374ab4a66f329c6a03 (diff) |
updated table creation files
25 files changed, 80 insertions, 57 deletions
diff --git a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql index 69b64bc41..286f612bc 100644 --- a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql +++ b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql @@ -19,12 +19,13 @@ CREATE TABLE auditor_amount_arithmetic_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + problem_row_id BIGINT NOT NULL, -- TODO: correct constraintcheck, currently wrong --operation BYTEA NOT NULL CHECK (LENGTH(operation)=16), operation TEXT NOT NULL PRIMARY KEY, - exchange_amount taler_amount, - auditor_amount taler_amount, - profitable BOOLEAN, + exchange_amount taler_amount NOT NULL, + auditor_amount taler_amount NOT NULL, + profitable BOOLEAN NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_amount_arithmetic_inconsistency diff --git a/src/auditordb/0002-auditor_bad_sig_losses.sql b/src/auditordb/0002-auditor_bad_sig_losses.sql index c5a222251..8be983670 100644 --- a/src/auditordb/0002-auditor_bad_sig_losses.sql +++ b/src/auditordb/0002-auditor_bad_sig_losses.sql @@ -18,8 +18,9 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_bad_sig_losses ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - operation TEXT, - loss taler_amount, + problem_row_id BIGINT NOT NULL, + operation TEXT NOT NULL, + loss taler_amount NOT NULL, operation_specific_pub BYTEA NOT NULL CHECK (LENGTH(operation_specific_pub)=32), suppressed BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (operation, operation_specific_pub) diff --git a/src/auditordb/0002-auditor_balances.sql b/src/auditordb/0002-auditor_balances.sql index 78ff8a414..e25c3049c 100644 --- a/src/auditordb/0002-auditor_balances.sql +++ b/src/auditordb/0002-auditor_balances.sql @@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS auditor_balances ( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY, + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY, balance_key TEXT PRIMARY KEY NOT NULL, balance_value taler_amount diff --git a/src/auditordb/0002-auditor_closure_lags.sql b/src/auditordb/0002-auditor_closure_lags.sql index 93484f399..d41a55eae 100644 --- a/src/auditordb/0002-auditor_closure_lags.sql +++ b/src/auditordb/0002-auditor_closure_lags.sql @@ -18,10 +18,11 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_closure_lags ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount taler_amount, - deadline BIGINT, - wtid BYTEA, - account BYTEA, + problem_row_id BIGINT NOT NULL, + amount taler_amount NOT NULL, + deadline BIGINT NOT NULL, + wtid BYTEA NOT NULL, + account BYTEA NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_closure_lags diff --git a/src/auditordb/0002-auditor_coin_inconsistency.sql b/src/auditordb/0002-auditor_coin_inconsistency.sql index ea5210d68..c9c1b02fc 100644 --- a/src/auditordb/0002-auditor_coin_inconsistency.sql +++ b/src/auditordb/0002-auditor_coin_inconsistency.sql @@ -18,11 +18,12 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_coin_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + problem_row_id BIGINT NOT NULL, operation TEXT NOT NULL, - exchange_amount taler_amount, - auditor_amount taler_amount, + exchange_amount taler_amount NOT NULL, + auditor_amount taler_amount NOT NULL, coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32), - profitable BOOLEAN, + profitable BOOLEAN NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (operation, coin_pub) ); diff --git a/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql b/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql index 029bc90e0..4c91eded6 100644 --- a/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql +++ b/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql @@ -18,9 +18,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_denomination_key_validity_withdraw_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + problem_row_id BIGINT NOT NULL, execution_date BIGINT, - reserve_pub BYTEA, - denompub_h BYTEA, + reserve_pub BYTEA NOT NULL, + denompub_h BYTEA NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_denomination_key_validity_withdraw_inconsistency diff --git a/src/auditordb/0002-auditor_denominations_without_sigs.sql b/src/auditordb/0002-auditor_denominations_without_sigs.sql index 94ea0a351..77dc3b153 100644 --- a/src/auditordb/0002-auditor_denominations_without_sigs.sql +++ b/src/auditordb/0002-auditor_denominations_without_sigs.sql @@ -18,9 +18,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_denominations_without_sigs ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + problem_row_id BIGINT NOT NULL, denompub_h BYTEA PRIMARY KEY, - value taler_amount, - start_time BIGINT, + value taler_amount NOT NULL, + start_time BIGINT NOT NULL, end_time BIGINT, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); diff --git a/src/auditordb/0002-auditor_deposit_confirmations.sql b/src/auditordb/0002-auditor_deposit_confirmations.sql index 7e47b4fd1..2c9bbf951 100644 --- a/src/auditordb/0002-auditor_deposit_confirmations.sql +++ b/src/auditordb/0002-auditor_deposit_confirmations.sql @@ -16,6 +16,7 @@ CREATE TABLE auditor_deposit_confirmations (deposit_confirmation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE + ,problem_row_id BIGINT NOT NULL ,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64) ,h_policy BYTEA NOT NULL CHECK (LENGTH(h_policy)=64) ,h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64) diff --git a/src/auditordb/0002-auditor_emergency.sql b/src/auditordb/0002-auditor_emergency.sql index 5fcd3cd06..a97befc0b 100644 --- a/src/auditordb/0002-auditor_emergency.sql +++ b/src/auditordb/0002-auditor_emergency.sql @@ -20,12 +20,13 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_emergency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + problem_row_id BIGINT NOT NULL, denompub_h BYTEA CHECK (LENGTH(denompub_h)=64), - denom_risk taler_amount, - denom_loss taler_amount, - deposit_start BIGINT, + denom_risk taler_amount NOT NULL, + denom_loss taler_amount NOT NULL, + deposit_start BIGINT NOT NULL, deposit_end BIGINT, - value taler_amount + value taler_amount NOT NULL ); COMMENT ON TABLE auditor_emergency IS 'Report an emergency denomination.'; diff --git a/src/auditordb/0002-auditor_emergency_by_count.sql b/src/auditordb/0002-auditor_emergency_by_count.sql index ff8ba405a..41ff89cea 100644 --- a/src/auditordb/0002-auditor_emergency_by_count.sql +++ b/src/auditordb/0002-auditor_emergency_by_count.sql @@ -18,13 +18,14 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_emergency_by_count ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - denompub_h BYTEA, - num_issued BIGINT, - num_known BIGINT, - risk taler_amount, - start BIGINT, + problem_row_id BIGINT NOT NULL, + denompub_h BYTEA NOT NULL, + num_issued BIGINT NOT NULL, + num_known BIGINT NOT NULL, + risk taler_amount NOT NULL, + start BIGINT NOT NULL, deposit_end BIGINT, - value taler_amount, + value taler_amount NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_emergency_by_count diff --git a/src/auditordb/0002-auditor_fee_time_inconsistency.sql b/src/auditordb/0002-auditor_fee_time_inconsistency.sql index 1cea6caa6..128204bc4 100644 --- a/src/auditordb/0002-auditor_fee_time_inconsistency.sql +++ b/src/auditordb/0002-auditor_fee_time_inconsistency.sql @@ -18,9 +18,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_fee_time_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - type BYTEA, - time BIGINT, - diagnostic BYTEA, + problem_row_id BIGINT NOT NULL, + fee_type BYTEA NOT NULL, + fee_time BIGINT NOT NULL, + diagnostic BYTEA NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_fee_time_inconsistency diff --git a/src/auditordb/0002-auditor_historic_denomination_revenue.sql b/src/auditordb/0002-auditor_historic_denomination_revenue.sql index d711ac7fc..8576387a4 100644 --- a/src/auditordb/0002-auditor_historic_denomination_revenue.sql +++ b/src/auditordb/0002-auditor_historic_denomination_revenue.sql @@ -16,6 +16,7 @@ CREATE TABLE auditor_historic_denomination_revenue (row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + problem_row_id BIGINT NOT NULL, denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64) ,revenue_timestamp BIGINT NOT NULL ,revenue_balance taler_amount NOT NULL diff --git a/src/auditordb/0002-auditor_historic_reserve_summary.sql b/src/auditordb/0002-auditor_historic_reserve_summary.sql index 0dc68d594..0c97befb2 100644 --- a/src/auditordb/0002-auditor_historic_reserve_summary.sql +++ b/src/auditordb/0002-auditor_historic_reserve_summary.sql @@ -18,12 +18,12 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_historic_reserve_summary ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - start_date BIGINT, + problem_row_id BIGINT NOT NULL, + start_date BIGINT NOT NULL, end_date BIGINT NOT NULL, reserve_profits taler_amount NOT NULL, PRIMARY KEY (start_date, end_date) - ); COMMENT ON TABLE auditor_historic_reserve_summary IS 'historic profits from reserves; we eventually GC auditor_historic_reserve_revenue, and then store the totals in here (by time intervals).'; diff --git a/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql b/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql index 48050412d..d212f5768 100644 --- a/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql +++ b/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql @@ -18,9 +18,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_misattribution_in_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount taler_amount, - bank_row BIGINT, - reserve_pub BYTEA, + problem_row_id BIGINT NOT NULL, + amount taler_amount NOT NULL, + bank_row BIGINT NOT NULL, + reserve_pub BYTEA NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_misattribution_in_inconsistency diff --git a/src/auditordb/0002-auditor_pending_deposits.sql b/src/auditordb/0002-auditor_pending_deposits.sql index 5cef7bf8c..847885e48 100644 --- a/src/auditordb/0002-auditor_pending_deposits.sql +++ b/src/auditordb/0002-auditor_pending_deposits.sql @@ -17,9 +17,10 @@ CREATE TABLE IF NOT EXISTS auditor_pending_deposits ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - total_amount taler_amount, - wire_target_h_payto BYTEA, - batch_deposit_serial_id BIGINT, - deadline BIGINT, + problem_row_id BIGINT NOT NULL, + total_amount taler_amount NOT NULL, + wire_target_payto TEXT NOT NULL, + batch_deposit_serial_id BIGINT NOT NULL, + deadline BIGINT NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); diff --git a/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql b/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql index e7f6078f0..470f759c6 100644 --- a/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql +++ b/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql @@ -17,10 +17,11 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_purse_not_closed_inconsistencies ( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE , - purse_pub BYTEA PRIMARY KEY, - amount taler_amount, - expiration_date BIGINT, + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, + problem_row_id BIGINT NOT NULL, + purse_pub BYTEA PRIMARY KEY NOT NULL, + amount taler_amount NOT NULL, + expiration_date BIGINT NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_purse_not_closed_inconsistencies diff --git a/src/auditordb/0002-auditor_purses.sql b/src/auditordb/0002-auditor_purses.sql index 9cfe2b095..6a100fd6e 100644 --- a/src/auditordb/0002-auditor_purses.sql +++ b/src/auditordb/0002-auditor_purses.sql @@ -15,8 +15,9 @@ -- CREATE TABLE auditor_purses - (auditor_purses_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE - ,purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32) + (auditor_purses_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE NOT NULL + ,problem_row_id BIGINT NOT NULL + ,purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32) NOT NULL ,balance taler_amount NOT NULL DEFAULT(0,0) ,target taler_amount NOT NULL ,expiration_date BIGINT NOT NULL diff --git a/src/auditordb/0002-auditor_refreshes_hanging.sql b/src/auditordb/0002-auditor_refreshes_hanging.sql index c42d17c6c..f9ef5b743 100644 --- a/src/auditordb/0002-auditor_refreshes_hanging.sql +++ b/src/auditordb/0002-auditor_refreshes_hanging.sql @@ -17,9 +17,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_refreshes_hanging ( - row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE, - amount taler_amount, - coin_pub BYTEA PRIMARY KEY, + row_id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY UNIQUE, + problem_row_id BIGINT NOT NULL, + amount taler_amount NOT NULL, + coin_pub BYTEA PRIMARY KEY NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_refreshes_hanging diff --git a/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql b/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql index 533f35681..00ec2fee2 100644 --- a/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql +++ b/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql @@ -18,9 +18,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_reserve_balance_insufficient_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + problem_row_id BIGINT NOT NULL, reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32), - inconsistency_gain BOOLEAN, - inconsistency_amount taler_amount, + inconsistency_gain BOOLEAN NOT NULL, + inconsistency_amount taler_amount NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_reserve_balance_insufficient_inconsistency diff --git a/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql b/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql index 12618d101..bd99e1dc8 100644 --- a/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql +++ b/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql @@ -18,9 +18,10 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_reserve_balance_summary_wrong_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - reserve_pub BYTEA, - exchange_amount taler_amount, - auditor_amount taler_amount, + problem_row_id BIGINT NOT NULL, + reserve_pub BYTEA NOT NULL, + exchange_amount taler_amount NOT NULL, + auditor_amount taler_amount NOT NULL, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); COMMENT ON TABLE auditor_reserve_balance_summary_wrong_inconsistency diff --git a/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql b/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql index ef0381bd1..7c588a34c 100644 --- a/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql +++ b/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql @@ -18,8 +18,9 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_reserve_not_closed_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE , - reserve_pub BYTEA PRIMARY KEY, - balance taler_amount, + problem_row_id BIGINT NOT NULL, + reserve_pub BYTEA PRIMARY KEY NOT NULL, + balance taler_amount NOT NULL, expiration_time BIGINT, diagnostic BYTEA, suppressed BOOLEAN NOT NULL DEFAULT FALSE diff --git a/src/auditordb/0002-auditor_reserves.sql b/src/auditordb/0002-auditor_reserves.sql index f50653512..9a7506b0f 100644 --- a/src/auditordb/0002-auditor_reserves.sql +++ b/src/auditordb/0002-auditor_reserves.sql @@ -16,6 +16,7 @@ CREATE TABLE auditor_reserves (auditor_reserves_rowid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE + ,problem_row_id BIGINT NOT NULL ,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32) ,reserve_balance taler_amount NOT NULL ,reserve_loss taler_amount NOT NULL diff --git a/src/auditordb/0002-auditor_row_inconsistency.sql b/src/auditordb/0002-auditor_row_inconsistency.sql index 6fae517bf..195d33030 100644 --- a/src/auditordb/0002-auditor_row_inconsistency.sql +++ b/src/auditordb/0002-auditor_row_inconsistency.sql @@ -18,6 +18,7 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_row_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + problem_row_id BIGINT NOT NULL, row_table TEXT NOT NULL, diagnostic TEXT NOT NULL, problem_row_id INT8 NOT NULL, diff --git a/src/auditordb/0002-auditor_wire_format_inconsistency.sql b/src/auditordb/0002-auditor_wire_format_inconsistency.sql index dc95f7956..e77870a62 100644 --- a/src/auditordb/0002-auditor_wire_format_inconsistency.sql +++ b/src/auditordb/0002-auditor_wire_format_inconsistency.sql @@ -18,8 +18,9 @@ SET search_path TO auditor; CREATE TABLE IF NOT EXISTS auditor_wire_format_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, - amount taler_amount, - wire_offset BIGINT, + problem_row_id BIGINT NOT NULL, + amount taler_amount NOT NULL, + wire_offset BIGINT NOT NULL, diagnostic BYTEA, suppressed BOOLEAN NOT NULL DEFAULT FALSE ); diff --git a/src/auditordb/0002-auditor_wire_out_inconsistency.sql b/src/auditordb/0002-auditor_wire_out_inconsistency.sql index d46c2b283..9e605d068 100644 --- a/src/auditordb/0002-auditor_wire_out_inconsistency.sql +++ b/src/auditordb/0002-auditor_wire_out_inconsistency.sql @@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS auditor_wire_out_inconsistency ( row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY, + problem_row_id BIGINT NOT NULL, destination_account TEXT NOT NULL, diagnostic TEXT NOT NULL, wire_out_serial_id INT8 NOT NULL, |