summaryrefslogtreecommitdiff
path: root/src/exchangedb/0002-deposits.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/0002-deposits.sql')
-rw-r--r--src/exchangedb/0002-deposits.sql9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/exchangedb/0002-deposits.sql b/src/exchangedb/0002-deposits.sql
index 2be51903a..679103c45 100644
--- a/src/exchangedb/0002-deposits.sql
+++ b/src/exchangedb/0002-deposits.sql
@@ -26,7 +26,7 @@ BEGIN
PERFORM create_partitioned_table(
'CREATE TABLE %I'
'(deposit_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
- ',partition INT8 NOT NULL'
+ ',shard INT8 NOT NULL'
',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
',known_coin_id INT8 NOT NULL' -- FIXME: column needed!?
',amount_with_fee_val INT8 NOT NULL'
@@ -130,10 +130,13 @@ BEGIN
EXECUTE FORMAT (
'ALTER TABLE ' || table_name ||
' ADD CONSTRAINT ' || table_name || '_foreign_coin_pub'
+ ' FOREIGN KEY (coin_pub) '
' REFERENCES known_coins (coin_pub) ON DELETE CASCADE'
',ADD CONSTRAINT ' || table_name || '_foreign_coin_id'
+ ' FOREIGN KEY (known_coin_id) '
' REFERENCES known_coins (known_coin_id) ON DELETE CASCADE'
',ADD CONSTRAINT ' || table_name || '_foreign_policy_details'
+ ' FOREIGN KEY (policy_details_serial_id) '
' REFERENCES policy_details (policy_details_serial_id) ON DELETE CASCADE'
);
END
@@ -152,7 +155,7 @@ BEGIN
PERFORM create_partitioned_table(
'CREATE TABLE %I'
'(wire_deadline INT8 NOT NULL'
- ',partition INT8 NOT NULL'
+ ',shard INT8 NOT NULL'
',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
',deposit_serial_id INT8'
') %s ;'
@@ -182,7 +185,7 @@ BEGIN
EXECUTE FORMAT (
'CREATE INDEX ' || table_name || '_main_index '
'ON ' || table_name || ' '
- '(wire_deadline ASC, partition ASC, coin_pub);'
+ '(wire_deadline ASC, shard ASC, coin_pub);'
);
END
$$;