diff --git a/src/exchangedb/0003-age_withdraw.sql b/src/exchangedb/0002-age_withdrawl.sql
similarity index 100%
rename from src/exchangedb/0003-age_withdraw.sql
rename to src/exchangedb/0002-age_withdrawl.sql
diff --git a/src/exchangedb/0003-aml_history.sql b/src/exchangedb/0002-aml_history.sql
similarity index 100%
rename from src/exchangedb/0003-aml_history.sql
rename to src/exchangedb/0002-aml_history.sql
diff --git a/src/exchangedb/0003-aml_staff.sql b/src/exchangedb/0002-aml_staff.sql
similarity index 100%
rename from src/exchangedb/0003-aml_staff.sql
rename to src/exchangedb/0002-aml_staff.sql
diff --git a/src/exchangedb/0003-aml_status.sql b/src/exchangedb/0002-aml_status.sql
similarity index 100%
rename from src/exchangedb/0003-aml_status.sql
rename to src/exchangedb/0002-aml_status.sql
diff --git a/src/exchangedb/0003-kyc_attributes.sql b/src/exchangedb/0002-kyc_attributes.sql
similarity index 99%
rename from src/exchangedb/0003-kyc_attributes.sql
rename to src/exchangedb/0002-kyc_attributes.sql
index 56e274a31..9b18b6c2f 100644
--- a/src/exchangedb/0003-kyc_attributes.sql
+++ b/src/exchangedb/0002-kyc_attributes.sql
@@ -29,7 +29,6 @@ BEGIN
',h_payto BYTEA PRIMARY KEY CHECK (LENGTH(h_payto)=32)'
',kyc_prox BYTEA NOT NULL CHECK (LENGTH(kyc_prox)=32)'
',provider VARCHAR NOT NULL'
- ',birthdate VARCHAR'
',collection_time INT8 NOT NULL'
',expiration_time INT8 NOT NULL'
',encrypted_attributes BYTEA NOT NULL'
diff --git a/src/exchangedb/0003-purse_actions.sql b/src/exchangedb/0002-purse_actions.sql
similarity index 100%
rename from src/exchangedb/0003-purse_actions.sql
rename to src/exchangedb/0002-purse_actions.sql
diff --git a/src/exchangedb/0003-purse_deletion.sql b/src/exchangedb/0002-purse_deletion.sql
similarity index 100%
rename from src/exchangedb/0003-purse_deletion.sql
rename to src/exchangedb/0002-purse_deletion.sql
diff --git a/src/exchangedb/0002-wire_accounts.sql b/src/exchangedb/0002-wire_accounts.sql
index 628bc599b..0c167dba0 100644
--- a/src/exchangedb/0002-wire_accounts.sql
+++ b/src/exchangedb/0002-wire_accounts.sql
@@ -19,6 +19,9 @@ CREATE TABLE wire_accounts
,master_sig BYTEA CHECK (LENGTH(master_sig)=64)
,is_active BOOLEAN NOT NULL
,last_change INT8 NOT NULL
+ ,conversion_url VARCHAR DEFAULT (NULL)
+ ,debit_restrictions VARCHAR DEFAULT (NULL)
+ ,credit_restrictions VARCHAR DEFAULT (NULL)
);
COMMENT ON TABLE wire_accounts
IS 'Table with current and historic bank accounts of the exchange. Entries never expire as we need to remember the last_change column indefinitely.';
@@ -30,5 +33,13 @@ COMMENT ON COLUMN wire_accounts.is_active
IS 'true if we are currently supporting the use of this account.';
COMMENT ON COLUMN wire_accounts.last_change
IS 'Latest time when active status changed. Used to detect replays of old messages.';
+COMMENT ON COLUMN wire_accounts.conversion_url
+ IS 'URL of a currency conversion service if conversion is needed when this account is used; NULL if there is no conversion.';
+COMMENT ON COLUMN wire_accounts.debit_restrictions
+ IS 'JSON array describing restrictions imposed when debiting this account. Empty for no restrictions, NULL if account was migrated from previous database revision or account is disabled.';
+COMMENT ON COLUMN wire_accounts.credit_restrictions
+ IS 'JSON array describing restrictions imposed when crediting this account. Empty for no restrictions, NULL if account was migrated from previous database revision or account is disabled.';
+
+
-- "wire_accounts" has no sequence because it is a 'mutable' table
-- and is of no concern to the auditor
diff --git a/src/exchangedb/0004-kyc_attributes.sql b/src/exchangedb/0004-kyc_attributes.sql
deleted file mode 100644
index e45d46b3b..000000000
--- a/src/exchangedb/0004-kyc_attributes.sql
+++ /dev/null
@@ -1,44 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2023 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
---
-
-CREATE OR REPLACE FUNCTION master_table_kyc_attributes_V2()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
- table_name VARCHAR DEFAULT 'kyc_attributes';
-BEGIN
- EXECUTE FORMAT (
- 'ALTER TABLE ' || table_name ||
- ' DROP COLUMN birthdate;'
- );
-END $$;
-
-COMMENT ON FUNCTION master_table_kyc_attributes_V2
- IS 'Removes birthdate column from the kyc_attributes table';
-
-INSERT INTO exchange_tables
- (name
- ,version
- ,action
- ,partitioned
- ,by_range)
- VALUES
- ('kyc_attributes_V2'
- ,'exchange-0004'
- ,'master'
- ,TRUE
- ,FALSE);
diff --git a/src/exchangedb/0004-wire_accounts.sql b/src/exchangedb/0004-wire_accounts.sql
deleted file mode 100644
index 6114c821a..000000000
--- a/src/exchangedb/0004-wire_accounts.sql
+++ /dev/null
@@ -1,26 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2023 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
---
-
-ALTER TABLE wire_accounts
- ADD COLUMN conversion_url VARCHAR DEFAULT (NULL),
- ADD COLUMN debit_restrictions VARCHAR DEFAULT (NULL),
- ADD COLUMN credit_restrictions VARCHAR DEFAULT (NULL);
-COMMENT ON COLUMN wire_accounts.conversion_url
- IS 'URL of a currency conversion service if conversion is needed when this account is used; NULL if there is no conversion.';
-COMMENT ON COLUMN wire_accounts.debit_restrictions
- IS 'JSON array describing restrictions imposed when debiting this account. Empty for no restrictions, NULL if account was migrated from previous database revision or account is disabled.';
-COMMENT ON COLUMN wire_accounts.credit_restrictions
- IS 'JSON array describing restrictions imposed when crediting this account. Empty for no restrictions, NULL if account was migrated from previous database revision or account is disabled.';
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index 6d89decdc..cbe06ce0b 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -18,19 +18,13 @@ sqlinputs = \
exchange_do_*.sql \
procedures.sql.in \
0002-*.sql \
- exchange-0002.sql.in \
- 0003-*.sql \
- exchange-0003.sql.in \
- 0004-*.sql \
- exchange-0004.sql.in
+ exchange-0002.sql.in
sql_DATA = \
benchmark-0001.sql \
versioning.sql \
exchange-0001.sql \
exchange-0002.sql \
- exchange-0003.sql \
- exchange-0004.sql \
drop.sql \
procedures.sql
@@ -41,9 +35,7 @@ BUILT_SOURCES = \
procedures.sql
CLEANFILES = \
- exchange-0002.sql \
- exchange-0003.sql \
- exchange-0004.sql
+ exchange-0002.sql
procedures.sql: procedures.sql.in exchange_do_*.sql
chmod +w $@ || true
@@ -55,16 +47,6 @@ exchange-0002.sql: exchange-0002.sql.in 0002-*.sql
gcc -E -P -undef - < exchange-0002.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@
chmod ugo-w $@
-exchange-0003.sql: exchange-0003.sql.in 0003-*.sql
- chmod +w $@ || true
- gcc -E -P -undef - < exchange-0003.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@
- chmod ugo-w $@
-
-exchange-0004.sql: exchange-0004.sql.in 0004-*.sql
- chmod +w $@ || true
- gcc -E -P -undef - < exchange-0004.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@
- chmod ugo-w $@
-
check_SCRIPTS = \
test_idempotency.sh
diff --git a/src/exchangedb/exchange-0002.sql.in b/src/exchangedb/exchange-0002.sql.in
index f0bf339bc..35113fb5d 100644
--- a/src/exchangedb/exchange-0002.sql.in
+++ b/src/exchangedb/exchange-0002.sql.in
@@ -86,5 +86,14 @@ COMMENT ON TYPE exchange_do_array_reserve_insert_return_type
#include "0002-revolving_work_shards.sql"
#include "0002-partners.sql"
#include "0002-partner_accounts.sql"
+#include "0002-purse_actions.sql"
+#include "0002-purse_deletion.sql"
+#include "0002-kyc_attributes.sql"
+#include "0002-aml_status.sql"
+#include "0002-aml_staff.sql"
+#include "0002-aml_history.sql"
+#include "0002-age_withdraw.sql"
+
+
COMMIT;
diff --git a/src/exchangedb/exchange-0003.sql.in b/src/exchangedb/exchange-0003.sql.in
index cd16bfbd4..768aa778b 100644
--- a/src/exchangedb/exchange-0003.sql.in
+++ b/src/exchangedb/exchange-0003.sql.in
@@ -19,13 +19,6 @@ BEGIN;
SELECT _v.register_patch('exchange-0003', NULL, NULL);
SET search_path TO exchange;
-#include "0003-purse_actions.sql"
-#include "0003-purse_deletion.sql"
-#include "0003-kyc_attributes.sql"
-#include "0003-aml_status.sql"
-#include "0003-aml_staff.sql"
-#include "0003-aml_history.sql"
-#include "0003-age_withdraw.sql"
COMMIT;
diff --git a/src/exchangedb/exchange-0004.sql.in b/src/exchangedb/exchange-0004.sql.in
deleted file mode 100644
index 02bdf017a..000000000
--- a/src/exchangedb/exchange-0004.sql.in
+++ /dev/null
@@ -1,25 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2023 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
---
-
-BEGIN;
-
-SELECT _v.register_patch('exchange-0004', NULL, NULL);
-SET search_path TO exchange;
-
-#include "0004-kyc_attributes.sql"
-#include "0004-wire_accounts.sql"
-
-COMMIT;