merchant-0041.sql (1625B)
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-0041.sql 17 -- @brief Add trigger to notify merchant on account changes 18 -- @author Christian Grothoff 19 20 BEGIN; 21 22 SELECT _v.register_patch('merchant-0041', NULL, NULL); 23 24 SET search_path TO merchant; 25 26 CREATE PROCEDURE merchant.merchant_0041_init(s TEXT) 27 LANGUAGE plpgsql 28 AS $OUTER$ 29 BEGIN 30 EXECUTE format('SET LOCAL search_path TO %I', s); 31 32 CREATE OR REPLACE FUNCTION merchant_account_change_trigger() 33 RETURNS TRIGGER LANGUAGE plpgsql AS $$ BEGIN RETURN NULL; END $$; 34 CREATE TRIGGER merchant_accounts_on_insert 35 AFTER INSERT OR UPDATE OR DELETE 36 ON merchant_accounts 37 FOR EACH ROW EXECUTE FUNCTION merchant_account_change_trigger(); 38 39 SET LOCAL search_path TO merchant; 40 END 41 $OUTER$; 42 43 INSERT INTO merchant.instance_fixups 44 (migration_name 45 ,version) 46 VALUES 47 ('merchant_0041_init' 48 ,41); 49 -- Apply new fix-up to existing instances 50 CALL merchant.fixup_instance_schema (41::INT8); 51 52 COMMIT;