Skip to content

Commit

Permalink
server: Add the address_transaction_details table
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexITC committed Nov 5, 2018
1 parent 84c6d69 commit 80f2760
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/conf/evolutions/default/6.sql
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;

0 comments on commit 80f2760

Please sign in to comment.