Canonical blocks (#108)

* Update Block w/ newest Block

* Add cascading delete to blocks and transactions tables

* Add handling for new conflicting blocks

* Command line version of sliding window n behind HEAD
This commit is contained in:
Matt K
2017-12-19 14:14:41 -06:00
committed by GitHub
parent 84e77f259d
commit 266c9587c8
19 changed files with 352 additions and 70 deletions
@@ -0,0 +1,11 @@
BEGIN;
ALTER TABLE transactions
DROP CONSTRAINT blocks_fk;
ALTER TABLE transactions
ADD CONSTRAINT fk_test
FOREIGN KEY (block_id)
REFERENCES blocks (id);
COMMIT;
@@ -0,0 +1,12 @@
BEGIN;
ALTER TABLE transactions
DROP CONSTRAINT fk_test;
ALTER TABLE transactions
ADD CONSTRAINT blocks_fk
FOREIGN KEY (block_id)
REFERENCES blocks (id)
ON DELETE CASCADE;
COMMIT;
@@ -0,0 +1,11 @@
BEGIN;
ALTER TABLE blocks
DROP CONSTRAINT node_fk;
ALTER TABLE blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (node_id)
REFERENCES nodes (id);
COMMIT;
@@ -0,0 +1,12 @@
BEGIN;
ALTER TABLE blocks
DROP CONSTRAINT node_fk;
ALTER TABLE blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (node_id)
REFERENCES nodes (id)
ON DELETE CASCADE;
COMMIT;