diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-03-09 21:03:18 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-03-09 21:03:18 +0100 |
commit | 72062fbe3ecc401fe74613d88b44f1bbb005f69e (patch) | |
tree | ea3207e91309e377bada9e00c7abcec53681a534 /src/backenddb/drop.sql | |
parent | c24599ff411d65107feb45eb6c86445f838b4a50 (diff) | |
download | merchant-72062fbe3ecc401fe74613d88b44f1bbb005f69e.tar.gz merchant-72062fbe3ecc401fe74613d88b44f1bbb005f69e.tar.bz2 merchant-72062fbe3ecc401fe74613d88b44f1bbb005f69e.zip |
improve drop.sql to avoid having to update it whenever new SQL revisions are added
Diffstat (limited to 'src/backenddb/drop.sql')
-rw-r--r-- | src/backenddb/drop.sql | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backenddb/drop.sql b/src/backenddb/drop.sql index 07a8ff12..9005b6ed 100644 --- a/src/backenddb/drop.sql +++ b/src/backenddb/drop.sql @@ -17,15 +17,15 @@ -- Everything in one big transaction BEGIN; --- This script DROPs all of the tables we create, including the --- versioning schema! --- --- Unlike the other SQL files, it SHOULD be updated to reflect the --- latest requirements for dropping tables. +-- This script DROPs all of the tables we create. -SELECT _v.unregister_patch('merchant-0001'); -SELECT _v.unregister_patch('merchant-0002'); -SELECT _v.unregister_patch('merchant-0003'); +WITH xpatches AS ( + SELECT patch_name + FROM _v.patches + WHERE starts_with(patch_name,'merchant-') +) + SELECT _v.unregister_patch(xpatches.patch_name) + FROM xpatches; DROP SCHEMA merchant CASCADE; |