summaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-07 15:08:20 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-07 15:32:14 +0200
commitd4361631fd23560c1cd5aa4d0a3458c37b22d42c (patch)
treef8cf3c621f4e31fa172ee59a81ce19f128dc0112 /src/backenddb
parent55605272856e9acefaa3cebcb81acef4806752fe (diff)
downloadmerchant-d4361631fd23560c1cd5aa4d0a3458c37b22d42c.tar.gz
merchant-d4361631fd23560c1cd5aa4d0a3458c37b22d42c.tar.bz2
merchant-d4361631fd23560c1cd5aa4d0a3458c37b22d42c.zip
add missing indices
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/merchant-0001.sql14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
index deb06e16..0adc495b 100644
--- a/src/backenddb/merchant-0001.sql
+++ b/src/backenddb/merchant-0001.sql
@@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS merchant_exchange_signing_keys
,expire_date INT8 NOT NULL
,end_date INT8 NOT NULL
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64),
- UNIQUE (master_pub, exchange_pub, start_date)
+ UNIQUE (exchange_pub, start_date, master_pub)
);
COMMENT ON TABLE merchant_exchange_signing_keys
IS 'Here we store proofs of the exchange online signing keys being signed by the exchange master key';
@@ -160,6 +160,7 @@ COMMENT ON COLUMN merchant_inventory.address
COMMENT ON COLUMN merchant_inventory.next_restock
IS 'GNUnet absolute time indicating when the next restock is expected. 0 for unknown.';
+
CREATE TABLE IF NOT EXISTS merchant_inventory_locks
(product_serial BIGINT NOT NULL
REFERENCES merchant_inventory (product_serial) -- NO "ON DELETE CASCADE": locks prevent deletion!
@@ -451,6 +452,17 @@ COMMENT ON COLUMN merchant_tip_reserves.tips_committed_val
IS 'Amount of outstanding approved tips that have not been picked up';
COMMENT ON COLUMN merchant_tip_reserves.tips_picked_up_val
IS 'Total amount tips that have been picked up from this reserve';
+CREATE INDEX IF NOT EXISTS merchant_tip_reserves_by_reserve_pub_and_merchant_serial
+ ON merchant_tip_reserves
+ (reserve_pub,merchant_serial,creation_time);
+CREATE INDEX IF NOT EXISTS merchant_tip_reserves_by_merchant_serial_and_creation_time
+ ON merchant_tip_reserves
+ (merchant_serial,creation_time);
+CREATE INDEX IF NOT EXISTS merchant_tip_reserves_by_exchange_balance
+ ON merchant_tip_reserves
+ (exchange_initial_balance_val,exchange_initial_balance_frac);
+
+
CREATE TABLE IF NOT EXISTS merchant_tip_reserve_keys
(reserve_serial BIGINT NOT NULL UNIQUE