-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: Add the address_transaction_details table
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
# --- !Ups | ||
|
||
CREATE TABLE address_transaction_details ( | ||
address ADDRESS_TYPE NOT NULL, | ||
txid TXID_TYPE NOT NULL, | ||
sent AMOUNT_TYPE NOT NULL, | ||
received AMOUNT_TYPE NOT NULL, | ||
time BIGINT NOT NULL, -- it is cheaper to carry this value from the tx than to use joins in each query | ||
-- constraints | ||
CONSTRAINT address_transaction_details_pk PRIMARY KEY (address, txid), | ||
CONSTRAINT address_transaction_details_txid_fk FOREIGN KEY (txid) REFERENCES transactions (txid) | ||
); | ||
|
||
CREATE INDEX address_transaction_details_txid_index ON address_transaction_details USING BTREE (txid); | ||
CREATE INDEX address_transaction_details_time_index ON address_transaction_details USING BTREE (time); | ||
|
||
# --- !Downs | ||
|
||
DROP INDEX address_transaction_details_time_index; | ||
DROP INDEX address_transaction_details_txid_index; | ||
DROP TABLE address_transaction_details; |