ipld-eth-server/db/migrations/00016_add_cascade_delete_to_blocks.sql
2019-02-26 00:52:54 -06:00

19 lines
319 B
SQL

-- +goose Up
ALTER TABLE blocks
DROP CONSTRAINT node_fk;
ALTER TABLE blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (node_id)
REFERENCES nodes (id)
ON DELETE CASCADE;
-- +goose Down
ALTER TABLE blocks
DROP CONSTRAINT node_fk;
ALTER TABLE blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (node_id)
REFERENCES nodes (id);