Associate saved transactions to their block

This commit is contained in:
Eric Meyer
2017-10-31 10:36:37 -05:00
parent 703acb99fb
commit faf018082f
5 changed files with 80 additions and 14 deletions
@@ -0,0 +1,2 @@
ALTER TABLE transactions
DROP COLUMN block_id
@@ -0,0 +1,5 @@
ALTER TABLE transactions
ADD COLUMN block_id INTEGER NOT NULL,
ADD CONSTRAINT fk_test
FOREIGN KEY (block_id)
REFERENCES blocks (id)
+11 -1
View File
@@ -87,7 +87,8 @@ CREATE TABLE transactions (
tx_to character varying(66),
tx_gaslimit numeric,
tx_gasprice numeric,
tx_value numeric
tx_value numeric,
block_id integer NOT NULL
);
@@ -148,6 +149,15 @@ ALTER TABLE ONLY transactions
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
--
-- Name: transactions fk_test; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY transactions
ADD CONSTRAINT fk_test FOREIGN KEY (block_id) REFERENCES blocks(id);
--
-- PostgreSQL database dump complete
--