exchange-0017.sql (1739B)
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 17 BEGIN; 18 19 SELECT _v.register_patch('exchange-0017', NULL, NULL); 20 21 SET search_path TO exchange; 22 23 CREATE FUNCTION alter_table_reserves_in17() 24 RETURNS void 25 LANGUAGE plpgsql 26 AS $$ 27 BEGIN 28 CREATE INDEX reserves_in_by_wire_source_h_payto 29 ON reserves_in 30 (wire_source_h_payto); 31 COMMENT ON INDEX reserves_in_by_wire_source_h_payto 32 IS 'finds the reserves an account wired to; used by exchange_do_get_kyc_rules, exchange_do_persist_kyc_attributes and iterate_withdraw_amounts_for_kyc_check'; 33 END 34 $$; 35 36 CREATE FUNCTION alter_table_contracts17() 37 RETURNS void 38 LANGUAGE plpgsql 39 AS $$ 40 BEGIN 41 CREATE INDEX contracts_by_pub_ckey 42 ON contracts 43 (pub_ckey); 44 COMMENT ON INDEX contracts_by_pub_ckey 45 IS 'for get_contract (GET /contracts/$CONTRACT_PUB)'; 46 END 47 $$; 48 49 INSERT INTO exchange_tables 50 (name 51 ,version 52 ,action 53 ,partitioned 54 ,by_range) 55 VALUES 56 ('reserves_in17' 57 ,'exchange-0017' 58 ,'alter' 59 ,TRUE 60 ,FALSE), 61 ('contracts17' 62 ,'exchange-0017' 63 ,'alter' 64 ,TRUE 65 ,FALSE); 66 67 COMMIT;