merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit a4cd488e387979ec221d11d752233facc023beb2
parent 547a5cc2f693ad1bc10c805e1bb28000c70e69ad
Author: Florian Dold <florian@dold.me>
Date:   Sun, 30 Jun 2024 17:07:37 +0200

fix DB migration

A botched merge modified an old migration file, causing the current
merchant to migrate the DB cleanly from old databases.

Diffstat:
Msrc/backenddb/Makefile.am | 1+
Msrc/backenddb/merchant-0006.sql | 6------
Msrc/backenddb/merchant-0009.sql | 10++++++++++
3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/backenddb/Makefile.am b/src/backenddb/Makefile.am @@ -25,6 +25,7 @@ sql_DATA = \ merchant-0006.sql \ merchant-0007.sql \ merchant-0008.sql \ + merchant-0009.sql \ drop.sql BUILT_SOURCES = \ diff --git a/src/backenddb/merchant-0006.sql b/src/backenddb/merchant-0006.sql @@ -26,12 +26,6 @@ SELECT _v.register_patch('merchant-0006', NULL, NULL); SET search_path TO merchant; -ALTER TABLE merchant_contract_terms - ADD COLUMN choice_index INT2 DEFAULT NULL; - -COMMENT ON COLUMN merchant_contract_terms.choice_index - IS 'Index of selected choice. Refers to the `choices` array in the contract terms. NULL for contracts without choices.'; - ALTER TABLE merchant_inventory ALTER COLUMN image SET DATA TYPE TEXT; diff --git a/src/backenddb/merchant-0009.sql b/src/backenddb/merchant-0009.sql @@ -29,5 +29,15 @@ SET search_path TO merchant; ALTER TABLE merchant_template DROP COLUMN required_currency; +-- Add the column with IF NOT EXISTS since this +-- migration accidentally was in merchant-0006.sql +-- for some time before it was moved here. +ALTER TABLE merchant_contract_terms + ADD COLUMN IF NOT EXISTS choice_index INT2 DEFAULT NULL; + +COMMENT ON COLUMN merchant_contract_terms.choice_index + IS 'Index of selected choice. Refers to the `choices` array in the contract terms. NULL for contracts without choices.'; + + -- Complete transaction COMMIT;