0003-legitimization_outcomes.sql (1295B)
1 -- 2 -- This file is part of TALER 3 -- Copyright (C) 2025 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 17 CREATE FUNCTION foreign_table_legitimization_outcomes3() 18 RETURNS void 19 LANGUAGE plpgsql 20 AS $$ 21 DECLARE 22 table_name TEXT DEFAULT 'legitimization_outcomes'; 23 BEGIN 24 EXECUTE FORMAT ( 25 'ALTER TABLE ' || table_name || 26 ' ADD CONSTRAINT ' || table_name || '_foreign_key_h_payto' 27 ' FOREIGN KEY (h_payto)' 28 ' REFERENCES kyc_targets (h_normalized_payto)' 29 ' ON DELETE CASCADE'); 30 END 31 $$; 32 33 34 INSERT INTO exchange_tables 35 (name 36 ,version 37 ,action 38 ,partitioned 39 ,by_range) 40 VALUES 41 ('legitimization_outcomes3' 42 ,'exchange-0003' 43 ,'foreign' 44 ,TRUE 45 ,FALSE);