diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-04-04 17:04:31 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-04-04 17:04:31 +0200 |
commit | df8ff01f2924f557096ec24ff650aefbf7931784 (patch) | |
tree | 7a798226ed71a22e6ebc7c9813b8166e8e524520 /src/exchangedb/common-0001.sql | |
parent | 914a77b5a7fefd19cddac1308ab1f16ca25cebbb (diff) | |
download | exchange-df8ff01f2924f557096ec24ff650aefbf7931784.tar.xz |
add contract_sig field
Diffstat (limited to 'src/exchangedb/common-0001.sql')
-rw-r--r-- | src/exchangedb/common-0001.sql | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql index 01e68dfb5..11386b22e 100644 --- a/src/exchangedb/common-0001.sql +++ b/src/exchangedb/common-0001.sql @@ -30,7 +30,7 @@ LANGUAGE plpgsql AS $$ BEGIN - IF shard_suffix IS NOT NULL THEN + IF shard_suffix IS NOT NULL THEN table_name=table_name || '_' || shard_suffix; main_table_partition_str = ''; END IF; @@ -41,7 +41,7 @@ BEGIN main_table_partition_str ); -END +END $$; ----------------------- wire_targets --------------------------- @@ -165,7 +165,7 @@ BEGIN ',wire_reference INT8 NOT NULL' ',credit_val INT8 NOT NULL' ',credit_frac INT4 NOT NULL' - ',wire_source_h_payto BYTEA CHECK (LENGTH(wire_source_h_payto)=32)' + ',wire_source_h_payto BYTEA CHECK (LENGTH(wire_source_h_payto)=32)' ',exchange_account_section TEXT NOT NULL' ',execution_date INT8 NOT NULL' ') %s ;' @@ -175,7 +175,7 @@ BEGIN ); table_name = concat_ws('_', table_name, shard_suffix); - + EXECUTE FORMAT ( 'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_reserve_in_serial_id_index ' 'ON ' || table_name || ' ' @@ -504,7 +504,7 @@ BEGIN ); table_name = concat_ws('_', table_name, shard_suffix); - + EXECUTE FORMAT ( 'CREATE INDEX IF NOT EXISTS ' || table_name || '_coins_by_melt_serial_id_index ' 'ON ' || table_name || ' ' @@ -618,7 +618,7 @@ BEGIN EXECUTE FORMAT ( 'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_coin_pub_index ' - 'ON ' || table_name || ' ' + 'ON ' || table_name || ' ' '(coin_pub);' ); @@ -928,7 +928,7 @@ BEGIN ); table_name = concat_ws('_', table_name, shard_suffix); - + EXECUTE FORMAT ( 'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_coin_pub_index ' 'ON ' || table_name || ' ' @@ -1014,7 +1014,7 @@ BEGIN ); table_name = concat_ws('_', table_name, shard_suffix); - + -- FIXME: any query using this index will be slow. Materialize index or change query? -- Also: which query uses this index? EXECUTE FORMAT ( @@ -1326,6 +1326,7 @@ BEGIN '(contract_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)' ',pub_ckey BYTEA NOT NULL CHECK (LENGTH(pub_ckey)=32)' + ',contract_sig BYTEA NOT NULL CHECK (LENGTH(contract_sig)=64)' ',e_contract BYTEA NOT NULL' ',purse_expiration INT8 NOT NULL' ',PRIMARY KEY (purse_pub)' @@ -1744,28 +1745,28 @@ BEGIN ALTER TABLE IF EXISTS reserves_in DETACH PARTITION reserves_in_default; - + ALTER TABLE IF EXISTS reserves_close DETACH PARTITION reserves_close_default; - + ALTER TABLE IF EXISTS reserves_out DETACH PARTITION reserves_out_default; ALTER TABLE IF EXISTS reserves_out_by_reserve DETACH PARTITION reserves_out_by_reserve_default; - + ALTER TABLE IF EXISTS known_coins DETACH PARTITION known_coins_default; - + ALTER TABLE IF EXISTS refresh_commitments DETACH PARTITION refresh_commitments_default; - + ALTER TABLE IF EXISTS refresh_revealed_coins DETACH PARTITION refresh_revealed_coins_default; - + ALTER TABLE IF EXISTS refresh_transfer_keys DETACH PARTITION refresh_transfer_keys_default; - + ALTER TABLE IF EXISTS deposits DETACH PARTITION deposits_default; @@ -1778,28 +1779,28 @@ BEGIN ALTER TABLE IF EXISTS refunds DETACH PARTITION refunds_default; - + ALTER TABLE IF EXISTS wire_out DETACH PARTITION wire_out_default; ALTER TABLE IF EXISTS aggregation_transient DETACH PARTITION aggregation_transient_default; - + ALTER TABLE IF EXISTS aggregation_tracking DETACH PARTITION aggregation_tracking_default; - + ALTER TABLE IF EXISTS recoup DETACH PARTITION recoup_default; ALTER TABLE IF EXISTS recoup_by_reserve DETACH PARTITION recoup_by_reserve_default; - + ALTER TABLE IF EXISTS recoup_refresh DETACH PARTITION recoup_refresh_default; - + ALTER TABLE IF EXISTS prewire DETACH PARTITION prewire_default; - + ALTER TABLE IF EXISTS cs_nonce_locks DETACH partition cs_nonce_locks_default; @@ -1808,7 +1809,7 @@ BEGIN ALTER TABLE IF EXISTS purse_merges DETACH partition purse_merges_default; - + ALTER TABLE IF EXISTS account_merges DETACH partition account_merges_default; @@ -1817,10 +1818,10 @@ BEGIN ALTER TABLE IF EXISTS history_requests DETACH partition history_requests_default; - + ALTER TABLE IF EXISTS close_requests DETACH partition close_requests_default; - + ALTER TABLE IF EXISTS purse_deposits DETACH partition purse_deposits_default; @@ -1951,7 +1952,7 @@ BEGIN ,num_partitions ); PERFORM add_constraints_to_known_coins_partition(num_partitions::varchar); - + PERFORM create_hash_partition( 'refresh_commitments' ,modulus @@ -2096,7 +2097,7 @@ BEGIN ,num_partitions ); PERFORM add_constraints_to_account_merges_partition(num_partitions::varchar); - + PERFORM create_hash_partition( 'contracts' ,modulus @@ -2136,7 +2137,7 @@ BEGIN ,num_partitions ); PERFORM add_constraints_to_wads_in_partition(num_partitions::varchar); - + PERFORM create_hash_partition( 'wad_in_entries' ,modulus @@ -2308,7 +2309,7 @@ BEGIN END $$; - + CREATE OR REPLACE FUNCTION create_shard_server( shard_suffix VARCHAR @@ -2587,7 +2588,7 @@ BEGIN END $$; -COMMENT ON FUNCTION create_shard_server +COMMENT ON FUNCTION create_shard_server IS 'Create a shard server on the master node with all foreign tables and user mappings'; @@ -2613,10 +2614,10 @@ BEGIN ,'taler-exchange' ,'5432' ,'taler-exchange-httpd' - ); + ); END LOOP; END $$; -COMMIT;
\ No newline at end of file +COMMIT; |