0004-kyc_attributes.sql (1323B)
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 OR REPLACE FUNCTION constrain_table_kyc_attributes4( 18 IN partition_suffix TEXT 19 ) 20 RETURNS void 21 LANGUAGE plpgsql 22 AS $$ 23 DECLARE 24 table_name TEXT DEFAULT 'kyc_attributes'; 25 BEGIN 26 table_name = concat_ws('_', table_name, partition_suffix); 27 EXECUTE FORMAT ( 28 'ALTER TABLE ' || table_name || 29 ' ADD CONSTRAINT ' || table_name || '_legitimization_serial ' 30 'UNIQUE (h_payto,legitimization_serial)' 31 ); 32 END $$; 33 34 35 INSERT INTO exchange_tables 36 (name 37 ,version 38 ,action 39 ,partitioned 40 ,by_range) 41 VALUES 42 ('kyc_attributes4' 43 ,'exchange-0004' 44 ,'constrain' 45 ,TRUE 46 ,FALSE);