diff options
-rw-r--r-- | src/backenddb/merchant-0001.sql | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql index e959a071..1c9a8aaf 100644 --- a/src/backenddb/merchant-0001.sql +++ b/src/backenddb/merchant-0001.sql @@ -79,10 +79,10 @@ CREATE TABLE IF NOT EXISTS merchant_instances ,merchant_pub BYTEA NOT NULL UNIQUE CHECK (LENGTH(merchant_pub)=32) ,auth_hash BYTEA CHECK(LENGTH(auth_hash)=64) ,auth_salt BYTEA CHECK(LENGTH(auth_salt)=32) - ,merchant_id VARCHAR NOT NULL UNIQUE - ,merchant_name VARCHAR NOT NULL - ,website VARCHAR - ,email VARCHAR + ,merchant_id TEXT NOT NULL UNIQUE + ,merchant_name TEXT NOT NULL + ,website TEXT + ,email TEXT ,logo BYTEA ,address BYTEA NOT NULL ,jurisdiction BYTEA NOT NULL @@ -132,10 +132,10 @@ CREATE TABLE IF NOT EXISTS merchant_accounts REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE ,h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64) ,salt BYTEA NOT NULL CHECK (LENGTH(salt)=16) - ,credit_facade_url VARCHAR - ,credit_facade_credentials VARCHAR + ,credit_facade_url TEXT + ,credit_facade_credentials TEXT ,last_bank_serial INT8 NOT NULL DEFAULT (0) - ,payto_uri VARCHAR NOT NULL + ,payto_uri TEXT NOT NULL ,active BOOLEAN NOT NULL ,UNIQUE (merchant_serial,payto_uri) ,UNIQUE (h_wire) @@ -164,10 +164,10 @@ CREATE TABLE IF NOT EXISTS merchant_inventory (product_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,merchant_serial BIGINT NOT NULL REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE - ,product_id VARCHAR NOT NULL - ,description VARCHAR NOT NULL + ,product_id TEXT NOT NULL + ,description TEXT NOT NULL ,description_i18n BYTEA NOT NULL - ,unit VARCHAR NOT NULL + ,unit TEXT NOT NULL ,image BYTEA NOT NULL ,taxes BYTEA NOT NULL ,price taler_amount NOT NULL @@ -234,13 +234,13 @@ CREATE TABLE IF NOT EXISTS merchant_orders (order_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,merchant_serial BIGINT NOT NULL REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE - ,order_id VARCHAR NOT NULL + ,order_id TEXT NOT NULL ,claim_token BYTEA NOT NULL CHECK (LENGTH(claim_token)=16) ,h_post_data BYTEA NOT NULL CHECK (LENGTH(h_post_data)=64) ,pay_deadline INT8 NOT NULL ,creation_time INT8 NOT NULL ,contract_terms BYTEA NOT NULL - ,pos_key VARCHAR DEFAULT NULL + ,pos_key TEXT DEFAULT NULL ,pos_algorithm INT NOT NULL DEFAULT (0) ,UNIQUE (merchant_serial, order_id) ); @@ -288,7 +288,7 @@ CREATE TABLE IF NOT EXISTS merchant_contract_terms (order_serial BIGINT PRIMARY KEY ,merchant_serial BIGINT NOT NULL REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE - ,order_id VARCHAR NOT NULL + ,order_id TEXT NOT NULL ,contract_terms BYTEA NOT NULL ,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64) ,creation_time INT8 NOT NULL @@ -296,9 +296,9 @@ CREATE TABLE IF NOT EXISTS merchant_contract_terms ,refund_deadline INT8 NOT NULL ,paid BOOLEAN DEFAULT FALSE NOT NULL ,wired BOOLEAN DEFAULT FALSE NOT NULL - ,fulfillment_url VARCHAR - ,session_id VARCHAR DEFAULT '' NOT NULL - ,pos_key VARCHAR DEFAULT NULL + ,fulfillment_url TEXT + ,session_id TEXT DEFAULT '' NOT NULL + ,pos_key TEXT DEFAULT NULL ,pos_algorithm INT NOT NULL DEFAULT (0) ,claim_token BYTEA NOT NULL CHECK (LENGTH(claim_token)=16) ,UNIQUE (merchant_serial, order_id) @@ -360,7 +360,7 @@ CREATE TABLE IF NOT EXISTS merchant_deposits REFERENCES merchant_contract_terms (order_serial) ON DELETE CASCADE ,deposit_timestamp INT8 NOT NULL ,coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32) - ,exchange_url VARCHAR NOT NULL + ,exchange_url TEXT NOT NULL ,amount_with_fee taler_amount NOT NULL ,deposit_fee taler_amount NOT NULL ,refund_fee taler_amount NOT NULL @@ -390,7 +390,7 @@ CREATE TABLE IF NOT EXISTS merchant_refunds ,rtransaction_id BIGINT NOT NULL ,refund_timestamp INT8 NOT NULL ,coin_pub BYTEA NOT NULL - ,reason VARCHAR NOT NULL + ,reason TEXT NOT NULL ,refund_amount taler_amount NOT NULL ,UNIQUE (order_serial, coin_pub, rtransaction_id) ); @@ -418,7 +418,7 @@ COMMENT ON TABLE merchant_refund_proofs CREATE TABLE IF NOT EXISTS merchant_transfers (credit_serial INT8 GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY - ,exchange_url VARCHAR NOT NULL + ,exchange_url TEXT NOT NULL ,wtid BYTEA CHECK (LENGTH(wtid)=32) ,credit_amount taler_amount NOT NULL ,account_serial INT8 NOT NULL @@ -549,7 +549,7 @@ CREATE TABLE IF NOT EXISTS merchant_reward_reserve_keys (reserve_serial BIGINT NOT NULL UNIQUE REFERENCES merchant_reward_reserves (reserve_serial) ON DELETE CASCADE ,reserve_priv BYTEA NOT NULL UNIQUE CHECK (LENGTH(reserve_priv)=32) - ,exchange_url VARCHAR NOT NULL + ,exchange_url TEXT NOT NULL ,master_pub BYTEA NOT NULL CHECK (LENGTH(master_pub)=32) ); COMMENT ON TABLE merchant_reward_reserves @@ -563,8 +563,8 @@ CREATE TABLE IF NOT EXISTS merchant_rewards ,reserve_serial BIGINT NOT NULL REFERENCES merchant_reward_reserves (reserve_serial) ON DELETE CASCADE ,reward_id BYTEA NOT NULL UNIQUE CHECK (LENGTH(reward_id)=64) - ,justification VARCHAR NOT NULL - ,next_url VARCHAR NOT NULL + ,justification TEXT NOT NULL + ,next_url TEXT NOT NULL ,expiration INT8 NOT NULL ,amount taler_amount NOT NULL ,picked_up taler_amount NOT NULL DEFAULT (0, 0) @@ -619,7 +619,7 @@ CREATE TABLE IF NOT EXISTS merchant_kyc ,exchange_kyc_serial INT8 NOT NULL DEFAULT(0) ,account_serial INT8 NOT NULL REFERENCES merchant_accounts (account_serial) ON DELETE CASCADE -,exchange_url VARCHAR NOT NULL +,exchange_url TEXT NOT NULL ,PRIMARY KEY (account_serial,exchange_url) ); COMMENT ON TABLE merchant_kyc @@ -646,11 +646,11 @@ CREATE TABLE IF NOT EXISTS merchant_template (template_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,merchant_serial BIGINT NOT NULL REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE - ,template_id VARCHAR NOT NULL - ,template_description VARCHAR NOT NULL - ,pos_key VARCHAR DEFAULT NULL + ,template_id TEXT NOT NULL + ,template_description TEXT NOT NULL + ,pos_key TEXT DEFAULT NULL ,pos_algorithm INT NOT NULL DEFAULT (0) - ,template_contract VARCHAR NOT NULL -- in JSON format + ,template_contract TEXT NOT NULL -- in JSON format ,UNIQUE (merchant_serial, template_id) ); COMMENT ON TABLE merchant_template @@ -669,12 +669,12 @@ CREATE TABLE IF NOT EXISTS merchant_webhook (webhook_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,merchant_serial BIGINT NOT NULL REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE - ,webhook_id VARCHAR NOT NULL - ,event_type VARCHAR NOT NULL - ,url VARCHAR NOT NULL - ,http_method VARCHAR NOT NULL - ,header_template VARCHAR - ,body_template VARCHAR + ,webhook_id TEXT NOT NULL + ,event_type TEXT NOT NULL + ,url TEXT NOT NULL + ,http_method TEXT NOT NULL + ,header_template TEXT + ,body_template TEXT ,UNIQUE (merchant_serial, webhook_id) ); COMMENT ON TABLE merchant_webhook @@ -699,10 +699,10 @@ CREATE TABLE IF NOT EXISTS merchant_pending_webhooks REFERENCES merchant_webhook (webhook_serial) ON DELETE CASCADE ,next_attempt INT8 NOT NULL DEFAULT(0) ,retries INT4 NOT NULL DEFAULT(0) - ,url VARCHAR NOT NULL - ,http_method VARCHAR NOT NULL - ,header VARCHAR - ,body VARCHAR + ,url TEXT NOT NULL + ,http_method TEXT NOT NULL + ,header TEXT + ,body TEXT ,UNIQUE (merchant_serial, webhook_pending_serial) ); COMMENT ON TABLE merchant_pending_webhooks @@ -726,10 +726,10 @@ COMMENT ON COLUMN merchant_pending_webhooks.body 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 + ,payto_uri TEXT NOT NULL + ,conversion_url TEXT + ,debit_restrictions TEXT NOT NULL + ,credit_restrictions TEXT NOT NULL ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64) ); COMMENT ON TABLE merchant_exchange_accounts @@ -748,8 +748,8 @@ COMMENT ON COLUMN merchant_exchange_accounts.credit_restrictions CREATE TABLE IF NOT EXISTS merchant_exchange_keys (mek_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE - ,exchange_url VARCHAR PRIMARY KEY - ,keys_json VARCHAR NOT NULL + ,exchange_url TEXT PRIMARY KEY + ,keys_json TEXT NOT NULL ,expiration_time INT8 NOT NULL ); COMMENT ON TABLE merchant_exchange_keys |