move extension options to external table

This commit is contained in:
Christian Grothoff 2021-11-06 19:04:54 +01:00
parent 0b370a6814
commit 57acad487d
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 14 additions and 8 deletions

View File

@ -361,6 +361,11 @@ CREATE INDEX IF NOT EXISTS refresh_transfer_keys_coin_tpub
COMMENT ON INDEX refresh_transfer_keys_coin_tpub COMMENT ON INDEX refresh_transfer_keys_coin_tpub
IS 'for get_link (unsure if this helps or hurts for performance as there should be very few transfer public keys per rc, but at least in theory this helps the ORDER BY clause)'; IS 'for get_link (unsure if this helps or hurts for performance as there should be very few transfer public keys per rc, but at least in theory this helps the ORDER BY clause)';
CREATE TABLE IF NOT EXISTS extension_details
(extension_details_serial_id BIGSERIAL PRIMARY KEY
,extension_options VARCHAR);
COMMENT ON TABLE extension_details
IS 'Extensions that were provided with deposits (not yet used).';
CREATE TABLE IF NOT EXISTS deposits CREATE TABLE IF NOT EXISTS deposits
(deposit_serial_id BIGSERIAL PRIMARY KEY (deposit_serial_id BIGSERIAL PRIMARY KEY
@ -380,7 +385,7 @@ CREATE TABLE IF NOT EXISTS deposits
,tiny BOOLEAN NOT NULL DEFAULT FALSE ,tiny BOOLEAN NOT NULL DEFAULT FALSE
,done BOOLEAN NOT NULL DEFAULT FALSE ,done BOOLEAN NOT NULL DEFAULT FALSE
,extension_blocked BOOLEAN NOT NULL DEFAULT FALSE ,extension_blocked BOOLEAN NOT NULL DEFAULT FALSE
,extension_options VARCHAR ,extension_details_serial_id INT8 REFERENCES extension_details (extension_details_serial_id)
,UNIQUE (known_coin_id, merchant_pub, h_contract_terms) ,UNIQUE (known_coin_id, merchant_pub, h_contract_terms)
); );
COMMENT ON TABLE deposits COMMENT ON TABLE deposits

View File

@ -517,7 +517,8 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (&tiny), GNUNET_PQ_query_param_auto_from_type (&tiny),
GNUNET_PQ_query_param_auto_from_type (&done), GNUNET_PQ_query_param_auto_from_type (&done),
GNUNET_PQ_query_param_auto_from_type (&extension_blocked), GNUNET_PQ_query_param_auto_from_type (&extension_blocked),
TALER_PQ_query_param_json (td->details.deposits.extension_options), GNUNET_PQ_query_param_uint64 (
&td->details.deposits.extension_details_serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };

View File

@ -952,9 +952,9 @@ lrbt_cb_table_deposits (void *cls,
GNUNET_PQ_result_spec_auto_from_type ( GNUNET_PQ_result_spec_auto_from_type (
"extension_blocked", "extension_blocked",
&td.details.deposits.extension_blocked), &td.details.deposits.extension_blocked),
TALER_PQ_result_spec_json ( GNUNET_PQ_result_spec_uint64 (
"extension_options", "extension_details_serial_id",
&td.details.deposits.extension_options), &td.details.deposits.extension_details_serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };

View File

@ -2299,7 +2299,7 @@ prepare_statements (struct PostgresClosure *pg)
",tiny" ",tiny"
",done" ",done"
",extension_blocked" ",extension_blocked"
",extension_options" ",extension_details_serial_id"
" FROM deposits" " FROM deposits"
" WHERE deposit_serial_id > $1" " WHERE deposit_serial_id > $1"
" ORDER BY deposit_serial_id ASC;", " ORDER BY deposit_serial_id ASC;",
@ -2588,7 +2588,7 @@ prepare_statements (struct PostgresClosure *pg)
",tiny" ",tiny"
",done" ",done"
",extension_blocked" ",extension_blocked"
",extension_options" ",extension_details_serial_id"
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
" $11, $12, $13, $14, $15, $16, $17, $18);", " $11, $12, $13, $14, $15, $16, $17, $18);",

View File

@ -328,7 +328,7 @@ struct TALER_EXCHANGEDB_TableData
bool tiny; bool tiny;
bool done; bool done;
bool extension_blocked; bool extension_blocked;
json_t *extension_options; uint64_t extension_details_serial_id;
} deposits; } deposits;
struct struct