summaryrefslogtreecommitdiff
path: root/src/exchangedb/0002-aggregation_tracking.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-09-10 19:13:49 +0200
committerChristian Grothoff <christian@grothoff.org>2023-09-10 19:13:49 +0200
commit852c46668f1c9f766de9473c50e787e32a0f8697 (patch)
tree6106427e8da10610507b12cd4d663f3e66d8eae7 /src/exchangedb/0002-aggregation_tracking.sql
parentcf595fa8480e87e1522710cd8ea7db9174aa028b (diff)
downloadexchange-852c46668f1c9f766de9473c50e787e32a0f8697.tar.gz
exchange-852c46668f1c9f766de9473c50e787e32a0f8697.tar.bz2
exchange-852c46668f1c9f766de9473c50e787e32a0f8697.zip
major exchange DB schema change: store common properties of batch deposit in batch_deposits table, and coin-specific ones in coin_deposits table; plus minor cleanups
Diffstat (limited to 'src/exchangedb/0002-aggregation_tracking.sql')
-rw-r--r--src/exchangedb/0002-aggregation_tracking.sql9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/exchangedb/0002-aggregation_tracking.sql b/src/exchangedb/0002-aggregation_tracking.sql
index 7df495a41..d07960247 100644
--- a/src/exchangedb/0002-aggregation_tracking.sql
+++ b/src/exchangedb/0002-aggregation_tracking.sql
@@ -26,11 +26,11 @@ BEGIN
PERFORM create_partitioned_table(
'CREATE TABLE %I'
'(aggregation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
- ',deposit_serial_id INT8 PRIMARY KEY'
+ ',batch_deposit_serial_id INT8 PRIMARY KEY'
',wtid_raw BYTEA NOT NULL'
') %s ;'
,table_name
- ,'PARTITION BY HASH (deposit_serial_id)'
+ ,'PARTITION BY HASH (batch_deposit_serial_id)'
,partition_suffix
);
PERFORM comment_partitioned_table(
@@ -86,8 +86,9 @@ BEGIN
EXECUTE FORMAT (
'ALTER TABLE ' || table_name ||
' ADD CONSTRAINT ' || table_name || '_foreign_deposit'
- ' FOREIGN KEY (deposit_serial_id) '
- ' REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE' -- FIXME change to coin_pub + deposit_serial_id for more efficient deposit???
+ ' FOREIGN KEY (batch_deposit_serial_id)'
+ ' REFERENCES batch_deposits (batch_deposit_serial_id)'
+ ' ON DELETE CASCADE'
);
END
$$;