diff options
author | Florian Dold <florian@dold.me> | 2024-06-30 17:07:37 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-06-30 17:07:40 +0200 |
commit | a4cd488e387979ec221d11d752233facc023beb2 (patch) | |
tree | 00472a7b24952de5de49215d6110376ffcd93183 /src/backenddb | |
parent | 547a5cc2f693ad1bc10c805e1bb28000c70e69ad (diff) |
fix DB migration
A botched merge modified an old migration file, causing the current
merchant to migrate the DB cleanly from old databases.
Diffstat (limited to 'src/backenddb')
-rw-r--r-- | src/backenddb/Makefile.am | 1 | ||||
-rw-r--r-- | src/backenddb/merchant-0006.sql | 6 | ||||
-rw-r--r-- | src/backenddb/merchant-0009.sql | 10 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/backenddb/Makefile.am b/src/backenddb/Makefile.am index e6511fef..52737c2b 100644 --- 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 index e216b4ad..81a4e656 100644 --- 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 index babecf93..988a01c6 100644 --- 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; |