ipld-eth-server/db/migrations/00021_add_eth_node_fingerprint_to_blocks.sql
Rob Mulholand d9e2bece27 Consolidate migrations
- Facilitate modifying migrations without cascading consequences for
  later migrations updating the same tables
2019-03-23 10:57:39 -05:00

17 lines
351 B
SQL

-- +goose Up
ALTER TABLE blocks
ADD COLUMN eth_node_fingerprint VARCHAR(128);
UPDATE blocks
SET eth_node_fingerprint = (
SELECT eth_node_id FROM eth_nodes WHERE eth_nodes.id = blocks.eth_node_id
);
ALTER TABLE blocks
ALTER COLUMN eth_node_fingerprint SET NOT NULL;
-- +goose Down
ALTER TABLE blocks
DROP COLUMN eth_node_fingerprint;