commit 1a581c10dd613dbe4b312c34e81dbb46f79d5e69
parent 46b03e1c2c2d6764d13b5ca1c13bbc06e535a3ad
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 2 Aug 2026 22:08:01 +0200
remove dead tables: these are global, not per instance
Diffstat:
2 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/src/backenddb/sql-schema/merchant-0042.sql b/src/backenddb/sql-schema/merchant-0042.sql
@@ -0,0 +1,58 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2026 Taler Systems SA
+--
+-- TALER is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+
+-- @file merchant-0042.sql
+-- @brief drop the stray per-instance copies of tan_challenges and
+-- merchant_pending_webhooks created by merchant-0036-init
+
+-- Background: the 0036 refactor moved most tables into per-instance schemas,
+-- but tan_challenges and merchant_pending_webhooks are GLOBAL: all C code
+-- addresses them as merchant.tan_challenges / merchant.merchant_pending_webhooks,
+-- and merchant-0039 still ALTERs the global merchant.tan_challenges.
+-- merchant-0036-init nevertheless also creates per-instance copies of both.
+-- Those copies are never read or written, and are wrong-shaped for such use
+-- (the per-instance tan_challenges lacks instance_name, the per-instance
+-- merchant_pending_webhooks lacks merchant_serial). merchant-0036 has already
+-- been released (v1.6.9, v1.6.10), so it is left untouched and the stray
+-- tables are dropped here instead; registering the fix-up also removes them
+-- from instances created in the future.
+
+BEGIN;
+
+SELECT _v.register_patch('merchant-0042', NULL, NULL);
+
+SET search_path TO merchant;
+
+CREATE PROCEDURE merchant.merchant_0042_init(s TEXT)
+ LANGUAGE plpgsql
+ AS $OUTER$
+BEGIN
+ -- Schema-qualify explicitly: identically named GLOBAL tables exist in
+ -- the "merchant" schema and must NOT be affected.
+ EXECUTE format('DROP TABLE IF EXISTS %I.tan_challenges', s);
+ EXECUTE format('DROP TABLE IF EXISTS %I.merchant_pending_webhooks', s);
+END
+$OUTER$;
+
+INSERT INTO merchant.instance_fixups
+ (migration_name
+ ,version)
+ VALUES
+ ('merchant_0042_init'
+ ,42);
+-- Apply new fix-up to existing instances
+CALL merchant.fixup_instance_schema (42::INT8);
+
+COMMIT;
diff --git a/src/backenddb/sql-schema/meson.build b/src/backenddb/sql-schema/meson.build
@@ -119,6 +119,7 @@ generated_sql = [
['merchant-0039.sql'],
['merchant-0040.sql'],
['merchant-0041.sql'],
+ ['merchant-0042.sql'],
]
foreach g : generated_sql