merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

merchant-0053.sql (1847B)


      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 BEGIN;
     17 SELECT _v.register_patch('merchant-0053', NULL, NULL);
     18 
     19 CREATE PROCEDURE merchant.merchant_0053_init(s TEXT)
     20 LANGUAGE plpgsql AS $$
     21 BEGIN
     22   EXECUTE format('SET LOCAL search_path TO %I', s);
     23   CREATE TABLE merchant_report_deliveries (
     24     delivery_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
     25     report_serial BIGINT,
     26     job_id BIGINT UNIQUE,
     27     origin TEXT NOT NULL CHECK (origin IN ('test','scheduled')),
     28     due_at BIGINT,
     29     description TEXT NOT NULL,
     30     program_section TEXT NOT NULL,
     31     data_source TEXT NOT NULL,
     32     target_address TEXT NOT NULL,
     33     mime_type TEXT NOT NULL,
     34     created_at BIGINT NOT NULL,
     35     started_at BIGINT,
     36     finished_at BIGINT,
     37     worker_pid INT,
     38     worker_start TIMESTAMPTZ,
     39     error_code INT,
     40     error_detail TEXT,
     41     UNIQUE (report_serial, due_at)
     42   );
     43   CREATE INDEX ON merchant_report_deliveries(created_at);
     44   CREATE INDEX ON merchant_report_deliveries(report_serial, delivery_id);
     45   SET LOCAL search_path TO merchant;
     46 END $$;
     47 
     48 INSERT INTO merchant.instance_fixups (migration_name, version)
     49   VALUES ('merchant_0053_init',53);
     50 CALL merchant.fixup_instance_schema(53::INT8);
     51 COMMIT;