mte/include/sql/procedures.sql.in

84 lines
3.3 KiB
MySQL

--
-- This file is part of TALER
-- Copyright (C) 2014--2025 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;
SET search_path TO exchange;
#include "exchange_do_create_partitioned_table.sql"
#include "exchange_do_comment_partitioned_table.sql"
#include "exchange_do_comment_partitioned_column.sql"
#include "exchange_do_create_tables.sql"
#include "exchange_do_amount_specific.sql"
#include "exchange_do_withdraw.sql"
#include "exchange_do_refresh.sql"
#include "exchange_do_deposit.sql"
#include "exchange_do_check_deposit_idempotent.sql"
#include "exchange_do_melt.sql"
#include "exchange_do_select_deposits_missing_wire.sql"
#include "exchange_do_select_justification_for_missing_wire.sql"
#include "exchange_do_refund.sql"
#include "exchange_do_recoup_to_reserve.sql"
#include "exchange_do_recoup_to_coin.sql"
#include "exchange_do_main_gc.sql"
#include "exchange_do_purse_delete.sql"
#include "exchange_do_purse_deposit.sql"
#include "exchange_do_purse_merge.sql"
#include "exchange_do_reserve_purse.sql"
#include "exchange_do_expire_purse.sql"
#include "exchange_do_reserve_open_deposit.sql"
#include "exchange_do_reserve_open.sql"
#include "exchange_do_insert_or_update_policy_details.sql"
#include "exchange_do_insert_aml_decision.sql"
#include "exchange_do_insert_successor_measure.sql"
#include "exchange_do_insert_aml_officer.sql"
#include "exchange_do_reserves_in_insert.sql"
#include "exchange_do_batch_reserves_update.sql"
#include "exchange_do_get_link_data.sql"
#include "exchange_do_batch_coin_known.sql"
#include "exchange_do_kycauth_in_insert.sql"
#include "exchange_do_trigger_kyc_rule_for_account.sql"
#include "exchange_do_lookup_kyc_requirement_by_row.sql"
#include "exchange_do_insert_active_legitimization_measure.sql"
#include "exchange_do_select_aggregations_above_serial.sql"
#include "exchange_do_persist_kyc_attributes.sql"
#include "exchange_do_insert_aml_program_failure.sql"
#include "exchange_do_set_aml_lock.sql"
#include "exchange_do_insert_sanction_list_hit.sql"
#include "exchange_statistics_helpers.sql"
#include "exchange_trigger_purse_requests_insert.sql"
#include "exchange_trigger_withdraw_delete.sql"
#include "exchange_trigger_withdraw_insert.sql"
#include "exchange_trigger_reserves_in_insert.sql"
#include "exchange_trigger_purse_decision_insert.sql"
#include "exchange_do_get_kyc_rules.sql"
DROP PROCEDURE IF EXISTS exchange_do_gc;
CREATE PROCEDURE exchange_do_gc(
IN in_ancient_date INT8,
IN in_now INT8)
LANGUAGE plpgsql
AS $$
BEGIN
CALL exchange_do_main_gc(in_ancient_date,in_now);
CALL exchange_statistic_amount_gc ();
CALL exchange_statistic_bucket_gc ();
CALL exchange_statistic_counter_gc ();
END $$;
COMMENT ON PROCEDURE exchange_do_gc
IS 'calls all other garbage collection subroutines';
COMMIT;