0009-batch_deposits.sql (1433B)
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 CREATE FUNCTION alter_table_batch_deposits9() 18 RETURNS void 19 LANGUAGE plpgsql 20 AS $$ 21 BEGIN 22 -- This works because at the time of the migration 23 -- supported production systems did not NOT use any fees. 24 -- Otherwise, we'd have to iterate over the coins 25 -- deposited in this batch and subtract the deposit fees here. 26 ALTER TABLE batch_deposits 27 ADD COLUMN total_without_fee taler_amount; 28 UPDATE batch_deposits 29 SET total_without_fee=total_amount; 30 ALTER TABLE batch_deposits 31 ALTER COLUMN total_without_fee SET NOT NULL; 32 END 33 $$; 34 35 INSERT INTO exchange_tables 36 (name 37 ,version 38 ,action 39 ,partitioned 40 ,by_range) 41 VALUES 42 ('batch_deposits9' 43 ,'exchange-0009' 44 ,'alter' 45 ,TRUE 46 ,FALSE);