diff options
Diffstat (limited to 'src/backenddb/merchant-0002.sql')
-rw-r--r-- | src/backenddb/merchant-0002.sql | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/backenddb/merchant-0002.sql b/src/backenddb/merchant-0002.sql index 46428dd9..2656fedb 100644 --- a/src/backenddb/merchant-0002.sql +++ b/src/backenddb/merchant-0002.sql @@ -14,6 +14,10 @@ -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -- +-- This file includes migrations up to 0.8.2. +-- All migrations after that release should +-- to into a different file. + -- Everything in one big transaction BEGIN; @@ -59,6 +63,26 @@ ALTER TABLE merchant_transfer_signatures ALTER COLUMN credit_amount_val SET NOT NULL, ALTER COLUMN credit_amount_frac SET NOT NULL; +-- contract terms now also need to check the claim_token, +-- as we consider the fulfillment_url private +ALTER TABLE merchant_contract_terms + ADD COLUMN claim_token BYTEA; +UPDATE merchant_contract_terms mct + SET claim_token=ord.claim_token + FROM merchant_orders ord + WHERE mct.order_serial=ord.order_serial; +-- If the merchant_orders row already has been GCed, +-- we can't migrate to the correct claim_token anymore. +-- Instead of setting it to all zeroes (no auth), +-- we set it to a prefix of the h_contract_terms. +UPDATE merchant_contract_terms + SET claim_token = substring(h_contract_terms for 16) + WHERE claim_token IS NULL; +ALTER TABLE merchant_contract_terms + ALTER COLUMN claim_token SET NOT NULL, + ADD CHECK (LENGTH(claim_token)=16); +COMMENT ON COLUMN merchant_contract_terms.claim_token + IS 'Token optionally used to access the status of the order. All zeros (not NULL) if not used'; -- Complete transaction COMMIT; |