merchant

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

merchant-0042.sql (2338B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2026 Taler Systems SA
      4 --
      5 -- TALER is free software; you can redistribute it and/or modify it under the
      6 -- terms of the GNU General Public License as published by the Free Software
      7 -- Foundation; either version 3, or (at your option) any later version.
      8 --
      9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11 -- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 --
     13 -- You should have received a copy of the GNU General Public License along with
     14 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 
     16 -- @file merchant-0042.sql
     17 -- @brief drop the stray per-instance copies of tan_challenges and
     18 --        merchant_pending_webhooks created by merchant-0036-init
     19 
     20 -- Background: the 0036 refactor moved most tables into per-instance schemas,
     21 -- but tan_challenges and merchant_pending_webhooks are GLOBAL: all C code
     22 -- addresses them as merchant.tan_challenges / merchant.merchant_pending_webhooks,
     23 -- and merchant-0039 still ALTERs the global merchant.tan_challenges.
     24 -- merchant-0036-init nevertheless also creates per-instance copies of both.
     25 -- Those copies are never read or written, and are wrong-shaped for such use
     26 -- (the per-instance tan_challenges lacks instance_name, the per-instance
     27 -- merchant_pending_webhooks lacks merchant_serial).  merchant-0036 has already
     28 -- been released (v1.6.9, v1.6.10), so it is left untouched and the stray
     29 -- tables are dropped here instead; registering the fix-up also removes them
     30 -- from instances created in the future.
     31 
     32 BEGIN;
     33 
     34 SELECT _v.register_patch('merchant-0042', NULL, NULL);
     35 
     36 SET search_path TO merchant;
     37 
     38 CREATE PROCEDURE merchant.merchant_0042_init(s TEXT)
     39   LANGUAGE plpgsql
     40   AS $OUTER$
     41 BEGIN
     42   -- Schema-qualify explicitly: identically named GLOBAL tables exist in
     43   -- the "merchant" schema and must NOT be affected.
     44   EXECUTE format('DROP TABLE IF EXISTS %I.tan_challenges', s);
     45   EXECUTE format('DROP TABLE IF EXISTS %I.merchant_pending_webhooks', s);
     46 END
     47 $OUTER$;
     48 
     49 INSERT INTO merchant.instance_fixups
     50   (migration_name
     51   ,version)
     52   VALUES
     53   ('merchant_0042_init'
     54   ,42);
     55 -- Apply new fix-up to existing instances
     56 CALL merchant.fixup_instance_schema (42::INT8);
     57 
     58 COMMIT;