aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/common-0001.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-10-03 23:54:12 +0200
committerChristian Grothoff <christian@grothoff.org>2022-10-03 23:54:12 +0200
commit856b8e26c2b83ebce31eb35c9fc9f23641187be9 (patch)
tree534951703f78a785702d0d2d82a43b425684ca60 /src/exchangedb/common-0001.sql
parent4a487b179c013886721c4aa06af9c75e9aad508c (diff)
-more work on new DB logic
Diffstat (limited to 'src/exchangedb/common-0001.sql')
-rw-r--r--src/exchangedb/common-0001.sql8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql
index 4a0aac381..564bf3b35 100644
--- a/src/exchangedb/common-0001.sql
+++ b/src/exchangedb/common-0001.sql
@@ -459,7 +459,8 @@ BEGIN
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
'(reserve_open_deposit_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE / PRIMARY KEY'
- ',reserve_pub BYTEA NOT NULL' -- REFERENCES reserves (reserve_pub) ON DELETE CASCADE'
+ ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
+ ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=32)'
',request_timestamp INT8 NOT NULL'
',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
',coin_sig BYTEA NOT NULL CHECK (LENGTH(coin_sig)=64)'
@@ -496,7 +497,7 @@ BEGIN
EXECUTE FORMAT (
'ALTER TABLE reserves_open_deposits_' || partition_suffix || ' '
'ADD CONSTRAINT reserves_open_deposits_' || partition_suffix || '_coin_unique '
- 'PRIMARY KEY (coin_pub,reserve_pub)'
+ 'PRIMARY KEY (coin_pub,coin_sig)'
);
END
$$;
@@ -1749,6 +1750,9 @@ BEGIN
',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
',close_val INT8 NOT NULL'
',close_frac INT4 NOT NULL'
+ ',close_fee_val INT8 NOT NULL'
+ ',close_fee_frac INT4 NOT NULL'
+ ',payto_uri VARCHAR NOT NULL'
',PRIMARY KEY (reserve_pub,close_timestamp)'
') %s ;'
,table_name