0002-partners.sql (2189B)
1 -- 2 -- This file is part of TALER 3 -- Copyright (C) 2014--2022 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 TABLE partners 18 (partner_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE 19 ,partner_master_pub BYTEA NOT NULL CHECK(LENGTH(partner_master_pub)=32) 20 ,start_date INT8 NOT NULL 21 ,end_date INT8 NOT NULL 22 ,next_wad INT8 NOT NULL DEFAULT (0) 23 ,wad_frequency INT8 NOT NULL 24 ,wad_fee taler_amount NOT NULL 25 ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64) 26 ,partner_base_url TEXT NOT NULL 27 ,PRIMARY KEY (partner_master_pub, start_date) 28 ); 29 COMMENT ON TABLE partners 30 IS 'exchanges we do wad transfers to'; 31 COMMENT ON COLUMN partners.partner_master_pub 32 IS 'offline master public key of the partner'; 33 COMMENT ON COLUMN partners.start_date 34 IS 'starting date of the partnership'; 35 COMMENT ON COLUMN partners.end_date 36 IS 'end date of the partnership'; 37 COMMENT ON COLUMN partners.next_wad 38 IS 'at what time should we do the next wad transfer to this partner (frequently updated); set to forever after the end_date'; 39 COMMENT ON COLUMN partners.wad_frequency 40 IS 'how often do we promise to do wad transfers'; 41 COMMENT ON COLUMN partners.wad_fee 42 IS 'how high is the fee for a wallet to be added to a wad to this partner'; 43 COMMENT ON COLUMN partners.partner_base_url 44 IS 'base URL of the REST API for this partner'; 45 COMMENT ON COLUMN partners.master_sig 46 IS 'signature of our master public key affirming the partnership, of purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS'; 47 48 CREATE INDEX IF NOT EXISTS partner_by_wad_time 49 ON partners (next_wad ASC);