summaryrefslogtreecommitdiff
path: root/src/backenddb/merchant-0005.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-07-10 11:37:15 +0200
committerChristian Grothoff <christian@grothoff.org>2023-07-10 11:37:15 +0200
commit37b49525663aa3a78b7b3fd79adf1313652ee786 (patch)
tree35ee8e3a7fe03ccb346e241a9679fa4211c0a602 /src/backenddb/merchant-0005.sql
parent19794a97ebd1ad3f1ee04c9b8878c807cdfa079e (diff)
downloadmerchant-37b49525663aa3a78b7b3fd79adf1313652ee786.tar.gz
merchant-37b49525663aa3a78b7b3fd79adf1313652ee786.tar.bz2
merchant-37b49525663aa3a78b7b3fd79adf1313652ee786.zip
combine different merchant DB versions into one new master, rename tip->reward in tables
Diffstat (limited to 'src/backenddb/merchant-0005.sql')
-rw-r--r--src/backenddb/merchant-0005.sql65
1 files changed, 1 insertions, 64 deletions
diff --git a/src/backenddb/merchant-0005.sql b/src/backenddb/merchant-0005.sql
index a0e283fa..b7bf4c91 100644
--- a/src/backenddb/merchant-0005.sql
+++ b/src/backenddb/merchant-0005.sql
@@ -18,73 +18,10 @@
BEGIN;
-- Check patch versioning is in place.
-SELECT _v.register_patch('merchant-0005', NULL, NULL);
+-- SELECT _v.register_patch('merchant-0005', NULL, NULL);
SET search_path TO merchant;
-ALTER TABLE merchant_instances
- ADD COLUMN user_type INT;
-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 ready_time INT8 NOT NULL DEFAULT (0),
- ADD COLUMN failed BOOLEAN NOT NULL DEFAULT FALSE,
- ADD COLUMN validation_status INT4 DEFAULT NULL;
-COMMENT ON COLUMN merchant_transfers.failed
- IS 'set to true on permanent verification failures';
-COMMENT ON COLUMN merchant_transfers.validation_status
- IS 'Taler error code describing the state of the validation';
-
-CREATE INDEX merchant_transfers_by_open
- ON merchant_transfers
- (ready_time ASC)
- WHERE confirmed AND NOT (failed OR verified);
-COMMENT ON INDEX merchant_transfers_by_open
- IS 'For select_open_transfers';
-
-
-ALTER TABLE merchant_accounts
- ADD COLUMN credit_facade_url VARCHAR,
- ADD COLUMN credit_facade_credentials VARCHAR,
- ADD COLUMN last_bank_serial INT8 NOT NULL DEFAULT (0);
-COMMENT ON COLUMN merchant_accounts.credit_facade_url
- IS 'Base URL of a facade where the merchant can inquire about incoming bank transactions into this account';
-COMMENT ON COLUMN merchant_accounts.credit_facade_credentials
- IS 'JSON with credentials needed to access the credit facade';
-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;