diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-05-12 15:10:23 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-05-12 15:10:23 +0200 |
commit | a04425df340e9bef067cbf64809ced5597576dfc (patch) | |
tree | 1574dd5e1b5ff9095a0479d0e74ad2afe00269e8 /src/exchangedb/0003-age_withdraw_commitments.sql | |
parent | 5ee567d1bacf1422745bb0867a1022fd695bc5dc (diff) | |
download | exchange-a04425df340e9bef067cbf64809ced5597576dfc.tar.xz |
[age-withdraw] WIP: change schema to use new support for array types, 11/n
Diffstat (limited to 'src/exchangedb/0003-age_withdraw_commitments.sql')
-rw-r--r-- | src/exchangedb/0003-age_withdraw_commitments.sql | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/src/exchangedb/0003-age_withdraw_commitments.sql b/src/exchangedb/0003-age_withdraw_commitments.sql index d74a697c3..2ee462ecc 100644 --- a/src/exchangedb/0003-age_withdraw_commitments.sql +++ b/src/exchangedb/0003-age_withdraw_commitments.sql @@ -26,20 +26,22 @@ BEGIN PERFORM create_partitioned_table( 'CREATE TABLE %I' '(age_withdraw_commitment_id BIGINT GENERATED BY DEFAULT AS IDENTITY' - ',h_commitment BYTEA CHECK (LENGTH(h_commitment)=64)' - ',amount_with_fee_val INT8 NOT NULL' - ',amount_with_fee_frac INT4 NOT NULL' - ',max_age INT2 NOT NULL' - ',reserve_pub BYTEA CHECK (LENGTH(reserve_pub)=32)' - ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)' - ',noreveal_index INT4 NOT NULL' + ',h_commitment BYTEA NOT NULL CONSTRAINT h_commitment_length CHECK(LENGTH(h_commitment)=64)' + ',max_age SMALLINT NOT NULL CONSTRAINT max_age_positive CHECK(max_age>=0)' + ',reserve_pub BYTEA NOT NULL CONSTRAINT reserve_pub_length CHECK(LENGTH(reserve_pub)=32)' + ',reserve_sig BYTEA NOT NULL CONSTRAINT reserve_sig_length CHECK(LENGTH(reserve_sig)=64)' + ',num_coins SMALLINT NOT NULL CONSTRAINT num_coins_positive CHECK(num_coins>0)' + ',denominations_serials INT8[] NOT NULL CONSTRAINT denominations_serial_array_length CHECK(cardinality(denominations_serials)=num_coins)' + ',denom_sigs BYTEA[] NOT NULL CONSTRAINT denom_sigs_array_length CHECK(cardinality(denom_sigs)=num_coins)' + ',noreveal_index SMALLINT NOT NULL CONSTRAINT noreveal_index_positive CHECK(noreveal_index>=0)' ') %s ;' ,table_name ,'PARTITION BY HASH (reserve_pub)' ,partition_suffix ); PERFORM comment_partitioned_table( - 'Commitments made when withdrawing coins with age restriction and the gamma value chosen by the exchange.' + 'Commitments made when withdrawing coins with age restriction and the gamma value chosen by the exchange. ' + 'It also contains the blindly signed coins and related denominations.' ,table_name ,partition_suffix ); @@ -68,11 +70,29 @@ BEGIN ,partition_suffix ); PERFORM comment_partitioned_column( - 'Signature of the reserve''s private key over the withdraw-age request' + 'Signature of the reserve''s private key over the age-withdraw request' ,'reserve_sig' ,table_name ,partition_suffix ); + PERFORM comment_partinioned_column( + 'Number of coins to be withdrawn' + ,'num_coins' + ,table_name + ,partition_suffix + ); + PERFORM comment_partitioned_column( + 'Array of #num_coins of references to the denominations' + ,'denominations_serials' + ,table_name + ,partition_suffix + ); + PERFORM comment_partitioned_column( + 'Array of #num_coins signatures over the blinded envelopes' + ,'denom_sigs' + ,table_name + ,partition_suffix + ); END $$; @@ -122,13 +142,13 @@ END $$; -INSERT INTO exchange_tables +INSERT INTO exchange_tables (name ,version ,action ,partitioned ,by_range) -VALUES +VALUES ('age_withdraw_commitments', 'exchange-0003', 'create', TRUE ,FALSE), ('age_withdraw_commitments', 'exchange-0003', 'constrain',TRUE ,FALSE), ('age_withdraw_commitments', 'exchange-0003', 'foreign', TRUE ,FALSE); |