summaryrefslogtreecommitdiff
path: root/src/backenddb/drop.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-09 21:03:18 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-09 21:03:18 +0100
commit72062fbe3ecc401fe74613d88b44f1bbb005f69e (patch)
treeea3207e91309e377bada9e00c7abcec53681a534 /src/backenddb/drop.sql
parentc24599ff411d65107feb45eb6c86445f838b4a50 (diff)
downloadmerchant-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.sql16
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;