use separate mig for new chainID field so we can apply to current db
This commit is contained in:
parent
bf46200c07
commit
98f5a16771
@ -5,8 +5,7 @@ CREATE TABLE nodes (
|
|||||||
genesis_block VARCHAR(66),
|
genesis_block VARCHAR(66),
|
||||||
network_id VARCHAR,
|
network_id VARCHAR,
|
||||||
node_id VARCHAR(128),
|
node_id VARCHAR(128),
|
||||||
chain_id INTEGER,
|
CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id)
|
||||||
CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id, chain_id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
|
21
db/migrations/00012_add_chain_id_to_nodes.sql
Normal file
21
db/migrations/00012_add_chain_id_to_nodes.sql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
-- +goose Up
|
||||||
|
ALTER TABLE public.nodes
|
||||||
|
ADD COLUMN chain_id INTEGER DEFAULT 1;
|
||||||
|
|
||||||
|
ALTER TABLE public.nodes
|
||||||
|
DROP CONSTRAINT node_uc;
|
||||||
|
|
||||||
|
ALTER TABLE public.nodes
|
||||||
|
ADD CONSTRAINT node_uc
|
||||||
|
UNIQUE (genesis_block, network_id, node_id, chain_id);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
ALTER TABLE public.nodes
|
||||||
|
DROP CONSTRAINT node_uc;
|
||||||
|
|
||||||
|
ALTER TABLE public.nodes
|
||||||
|
ADD CONSTRAINT node_uc
|
||||||
|
UNIQUE (genesis_block, network_id, node_id);
|
||||||
|
|
||||||
|
ALTER TABLE public.nodes
|
||||||
|
DROP COLUMN chain_id;
|
Loading…
Reference in New Issue
Block a user