commit 3225ab7f2dd189bd3a5d756ec7e43b17b75e51a2
parent 2b4f259d5de3dfc772fdcb7caa29fb85e9f42cf6
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 12 Oct 2026 17:25:14 +0200
add missing indices
Diffstat:
2 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/src/exchangedb/sql-schema/exchange-0017.sql b/src/exchangedb/sql-schema/exchange-0017.sql
@@ -0,0 +1,67 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2026 Taler Systems SA
+--
+-- TALER is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+BEGIN;
+
+SELECT _v.register_patch('exchange-0017', NULL, NULL);
+
+SET search_path TO exchange;
+
+CREATE FUNCTION alter_table_reserves_in17()
+RETURNS void
+LANGUAGE plpgsql
+AS $$
+BEGIN
+ CREATE INDEX reserves_in_by_wire_source_h_payto
+ ON reserves_in
+ (wire_source_h_payto);
+ COMMENT ON INDEX reserves_in_by_wire_source_h_payto
+ 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';
+END
+$$;
+
+CREATE FUNCTION alter_table_contracts17()
+RETURNS void
+LANGUAGE plpgsql
+AS $$
+BEGIN
+ CREATE INDEX contracts_by_pub_ckey
+ ON contracts
+ (pub_ckey);
+ COMMENT ON INDEX contracts_by_pub_ckey
+ IS 'for get_contract (GET /contracts/$CONTRACT_PUB)';
+END
+$$;
+
+INSERT INTO exchange_tables
+ (name
+ ,version
+ ,action
+ ,partitioned
+ ,by_range)
+ VALUES
+ ('reserves_in17'
+ ,'exchange-0017'
+ ,'alter'
+ ,TRUE
+ ,FALSE),
+ ('contracts17'
+ ,'exchange-0017'
+ ,'alter'
+ ,TRUE
+ ,FALSE);
+
+COMMIT;
diff --git a/src/exchangedb/sql-schema/meson.build b/src/exchangedb/sql-schema/meson.build
@@ -193,6 +193,7 @@ generated_sql = [
['exchange-0014.sql', ['exchange-0014.sql']],
['exchange-0015.sql', ['exchange-0015.sql']],
['exchange-0016.sql', ['exchange-0016.sql']],
+ ['exchange-0017.sql', ['exchange-0017.sql']],
['tops-0001.sql', ['tops-0001.sql']],
]