summaryrefslogtreecommitdiff
path: root/src/backenddb/merchant-0005.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-01 00:09:55 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-01 00:09:55 +0200
commit583c01c6224dd317f9665e623b02a32b74fdf74a (patch)
tree0b12e40c9dafde2b235c3c405a1ee032ff0e70d4 /src/backenddb/merchant-0005.sql
parenta7fe1d1b77ce1d7959522262f85788807d56316b (diff)
downloadmerchant-583c01c6224dd317f9665e623b02a32b74fdf74a.tar.gz
merchant-583c01c6224dd317f9665e623b02a32b74fdf74a.tar.bz2
merchant-583c01c6224dd317f9665e623b02a32b74fdf74a.zip
first rough cut at merchant update for #7810 (still with known bugs)
Diffstat (limited to 'src/backenddb/merchant-0005.sql')
-rw-r--r--src/backenddb/merchant-0005.sql30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/backenddb/merchant-0005.sql b/src/backenddb/merchant-0005.sql
index 8124341b..5c01e55b 100644
--- a/src/backenddb/merchant-0005.sql
+++ b/src/backenddb/merchant-0005.sql
@@ -27,6 +27,12 @@ ALTER TABLE merchant_instances
COMMENT ON COLUMN merchant_instances.user_type
IS 'what type of user is this (individual or business)';
+-- Column makes no sense for multi-account exchanges. Instead, we should
+-- lookup the various accounts of the exchange (by the master_pub) and return
+-- all of them (with constraints).
+ALTER TABLE merchant_tip_reserve_keys
+ DROP COLUMN payto_uri,
+ ADD COLUMN master_pub BYTEA NOT NULL CHECK (LENGTH(master_pub)=32);
ALTER TABLE merchant_transfers
ADD COLUMN failed BOOLEAN NOT NULL DEFAULT FALSE,
@@ -55,5 +61,29 @@ COMMENT ON COLUMN merchant_accounts.credit_facade_credentials
COMMENT ON COLUMN merchant_accounts.last_bank_serial
IS 'Serial number of the bank of the last transaction we successfully imported';
+
+CREATE TABLE IF NOT EXISTS merchant_exchange_accounts
+ (mea_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
+ ,master_pub BYTEA NOT NULL CHECK (LENGTH(master_pub)=32)
+ ,payto_uri VARCHAR NOT NULL
+ ,conversion_url VARCHAR
+ ,debit_restrictions VARCHAR NOT NULL
+ ,credit_restrictions VARCHAR NOT NULL
+ ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
+ );
+COMMENT ON TABLE merchant_exchange_accounts
+ IS 'Here we store which bank accounts the exchange uses and with which constraints';
+COMMENT ON COLUMN merchant_exchange_accounts.master_pub
+ IS 'Master public key of the exchange with these accounts';
+COMMENT ON COLUMN merchant_exchange_accounts.payto_uri
+ IS 'RFC 8905 URI of the exchange bank account';
+COMMENT ON COLUMN merchant_exchange_accounts.conversion_url
+ IS 'NULL if this account does not require currency conversion';
+COMMENT ON COLUMN merchant_exchange_accounts.debit_restrictions
+ IS 'JSON array with account restrictions';
+COMMENT ON COLUMN merchant_exchange_accounts.credit_restrictions
+ IS 'JSON array with account restrictions';
+
+
-- Complete transaction
COMMIT;