Remove tx from migrations (goose does it automagically)
This commit is contained in:
parent
bbb9260d13
commit
8de6fc45e1
@ -2,8 +2,8 @@
|
||||
CREATE TABLE public.blocks
|
||||
(
|
||||
block_number BIGINT
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.blocks
|
||||
DROP TABLE public.blocks;
|
||||
|
@ -8,7 +8,7 @@ CREATE TABLE transactions
|
||||
tx_gaslimit NUMERIC,
|
||||
tx_gasprice NUMERIC,
|
||||
tx_value NUMERIC
|
||||
)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE transactions
|
||||
DROP TABLE transactions;
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY
|
||||
ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE blocks DROP id
|
||||
ALTER TABLE blocks DROP id;
|
||||
|
@ -3,9 +3,9 @@ ALTER TABLE transactions
|
||||
ADD COLUMN block_id INTEGER NOT NULL,
|
||||
ADD CONSTRAINT fk_test
|
||||
FOREIGN KEY (block_id)
|
||||
REFERENCES blocks (id)
|
||||
REFERENCES blocks (id);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE transactions
|
||||
DROP COLUMN block_id
|
||||
DROP COLUMN block_id;
|
||||
|
@ -5,7 +5,7 @@ ALTER TABLE blocks
|
||||
ADD COLUMN block_nonce VARCHAR(20),
|
||||
ADD COLUMN block_parenthash VARCHAR(66),
|
||||
ADD COLUMN block_size BIGINT,
|
||||
ADD COLUMN uncle_hash VARCHAR(66)
|
||||
ADD COLUMN uncle_hash VARCHAR(66);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
@ -15,4 +15,4 @@ ALTER TABLE blocks
|
||||
drop COLUMN block_nonce,
|
||||
drop COLUMN block_parenthash,
|
||||
drop COLUMN block_size,
|
||||
drop COLUMN uncle_hash
|
||||
drop COLUMN uncle_hash;
|
||||
|
@ -3,7 +3,7 @@ CREATE TABLE watched_contracts
|
||||
(
|
||||
contract_id SERIAL PRIMARY KEY,
|
||||
contract_hash VARCHAR(66)
|
||||
)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE watched_contracts
|
||||
DROP TABLE watched_contracts;
|
||||
|
@ -1,8 +1,8 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE transactions
|
||||
ADD COLUMN tx_from VARCHAR(66)
|
||||
ADD COLUMN tx_from VARCHAR(66);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE transactions
|
||||
DROP COLUMN tx_from
|
||||
DROP COLUMN tx_from;
|
||||
|
@ -1,6 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE transactions
|
||||
DROP CONSTRAINT fk_test;
|
||||
|
||||
@ -10,12 +8,8 @@ FOREIGN KEY (block_id)
|
||||
REFERENCES blocks (id)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE transactions
|
||||
DROP CONSTRAINT blocks_fk;
|
||||
|
||||
@ -23,5 +17,3 @@ ALTER TABLE transactions
|
||||
ADD CONSTRAINT fk_test
|
||||
FOREIGN KEY (block_id)
|
||||
REFERENCES blocks (id);
|
||||
|
||||
COMMIT;
|
@ -1,6 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE blocks
|
||||
DROP CONSTRAINT node_fk;
|
||||
|
||||
@ -10,11 +8,7 @@ FOREIGN KEY (node_id)
|
||||
REFERENCES nodes (id)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- +goose Down
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE blocks
|
||||
DROP CONSTRAINT node_fk;
|
||||
|
||||
@ -22,5 +16,3 @@ ALTER TABLE blocks
|
||||
ADD CONSTRAINT node_fk
|
||||
FOREIGN KEY (node_id)
|
||||
REFERENCES nodes (id);
|
||||
|
||||
COMMIT;
|
@ -15,8 +15,5 @@ CREATE TABLE receipts
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE receipts;
|
||||
|
||||
|
@ -1,22 +1,14 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE nodes
|
||||
DROP CONSTRAINT node_uc;
|
||||
|
||||
ALTER TABLE nodes
|
||||
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id);
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- +goose Down
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE nodes
|
||||
DROP CONSTRAINT node_uc;
|
||||
|
||||
ALTER TABLE nodes
|
||||
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id);
|
||||
|
||||
COMMIT;
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE logs
|
||||
DROP CONSTRAINT log_uc;
|
||||
|
||||
@ -12,11 +11,8 @@ FOREIGN KEY (receipt_id)
|
||||
REFERENCES receipts (id)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- +goose Down
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE logs
|
||||
DROP CONSTRAINT receipts_fk;
|
||||
|
||||
@ -25,5 +21,3 @@ ALTER TABLE logs
|
||||
|
||||
ALTER TABLE logs
|
||||
ADD CONSTRAINT log_uc UNIQUE (block_number, index);
|
||||
|
||||
COMMIT;
|
@ -1,5 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE blocks
|
||||
ALTER COLUMN block_gaslimit TYPE BIGINT USING block_gaslimit :: BIGINT;
|
||||
|
||||
@ -15,12 +14,8 @@ ALTER TABLE blocks
|
||||
ALTER TABLE blocks
|
||||
ALTER COLUMN block_uncles_reward TYPE DOUBLE PRECISION USING block_time :: DOUBLE PRECISION;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE blocks
|
||||
ALTER COLUMN block_gaslimit TYPE DOUBLE PRECISION USING block_gaslimit :: DOUBLE PRECISION;
|
||||
|
||||
@ -35,5 +30,3 @@ ALTER TABLE blocks
|
||||
|
||||
ALTER TABLE blocks
|
||||
ALTER COLUMN block_uncles_reward TYPE NUMERIC USING block_time :: NUMERIC;
|
||||
|
||||
COMMIT;
|
@ -1,5 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE blocks
|
||||
RENAME COLUMN block_number TO number;
|
||||
|
||||
@ -38,21 +37,9 @@ ALTER TABLE blocks
|
||||
|
||||
ALTER TABLE blocks
|
||||
RENAME COLUMN block_uncles_reward TO uncles_reward;
|
||||
COMMIT;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- +goose Down
|
||||
BEGIN;
|
||||
ALTER TABLE blocks
|
||||
RENAME COLUMN number TO block_number;
|
||||
|
||||
@ -91,4 +78,3 @@ ALTER TABLE blocks
|
||||
|
||||
ALTER TABLE blocks
|
||||
RENAME COLUMN uncles_reward TO block_uncles_reward;
|
||||
COMMIT;
|
@ -1,5 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE transactions
|
||||
RENAME COLUMN tx_hash TO hash;
|
||||
|
||||
@ -17,12 +16,9 @@ ALTER TABLE transactions
|
||||
|
||||
ALTER TABLE transactions
|
||||
RENAME COLUMN tx_input_data TO input_data;
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE transactions
|
||||
RENAME COLUMN hash TO tx_hash;
|
||||
|
||||
@ -40,4 +36,3 @@ ALTER TABLE transactions
|
||||
|
||||
ALTER TABLE transactions
|
||||
RENAME COLUMN input_data TO tx_input_data;
|
||||
COMMIT;
|
||||
|
@ -1,19 +1,14 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE log_filters
|
||||
DROP CONSTRAINT log_filters_from_block_check1;
|
||||
|
||||
ALTER TABLE log_filters
|
||||
ADD CONSTRAINT log_filters_to_block_check CHECK (to_block >= 0);
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE log_filters
|
||||
DROP CONSTRAINT log_filters_to_block_check;
|
||||
|
||||
ALTER TABLE log_filters
|
||||
ADD CONSTRAINT log_filters_from_block_check1 CHECK (to_block >= 0);
|
||||
COMMIT;
|
@ -4,6 +4,5 @@ ALTER TABLE blocks
|
||||
|
||||
|
||||
-- +goose Down
|
||||
-- +goose Up
|
||||
ALTER TABLE blocks
|
||||
ALTER COLUMN size TYPE BIGINT USING size::BIGINT;
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
ALTER TABLE public.nodes RENAME TO eth_nodes;
|
||||
|
||||
ALTER TABLE public.eth_nodes RENAME COLUMN node_id TO eth_node_id;
|
||||
@ -19,10 +18,8 @@ ALTER TABLE public.blocks
|
||||
ADD CONSTRAINT node_fk
|
||||
FOREIGN KEY (eth_node_id) REFERENCES eth_nodes (id) ON DELETE CASCADE;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- +goose Down
|
||||
BEGIN;
|
||||
ALTER TABLE public.eth_nodes
|
||||
RENAME TO nodes;
|
||||
|
||||
@ -44,4 +41,3 @@ ALTER TABLE public.blocks DROP CONSTRAINT node_fk;
|
||||
ALTER TABLE public.blocks
|
||||
ADD CONSTRAINT node_fk
|
||||
FOREIGN KEY (node_id) REFERENCES nodes (id) ON DELETE CASCADE;
|
||||
COMMIT;
|
@ -1,6 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE receipts
|
||||
ADD COLUMN block_id INT;
|
||||
|
||||
@ -21,12 +19,8 @@ ON DELETE CASCADE;
|
||||
ALTER TABLE receipts
|
||||
DROP COLUMN transaction_id;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE receipts
|
||||
ADD COLUMN transaction_id INT;
|
||||
|
||||
@ -46,5 +40,3 @@ ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE receipts
|
||||
DROP COLUMN block_id;
|
||||
|
||||
COMMIT;
|
@ -1,6 +1,4 @@
|
||||
-- +goose Up
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE blocks
|
||||
ADD COLUMN eth_node_fingerprint VARCHAR(128);
|
||||
|
||||
@ -12,7 +10,6 @@ UPDATE blocks
|
||||
ALTER TABLE blocks
|
||||
ALTER COLUMN eth_node_fingerprint SET NOT NULL;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE blocks
|
||||
|
@ -7,9 +7,8 @@ CREATE TABLE token_supply (
|
||||
CONSTRAINT blocks_fk FOREIGN KEY (block_id)
|
||||
REFERENCES blocks (id)
|
||||
ON DELETE CASCADE
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
-- +goose Up
|
||||
DROP TABLE token_supply;
|
@ -12,5 +12,6 @@ CREATE TABLE public.headers (
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE public.headers;
|
@ -2,6 +2,5 @@
|
||||
CREATE SCHEMA maker;
|
||||
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP SCHEMA maker;
|
||||
|
@ -18,6 +18,7 @@ CREATE TABLE maker.flip_kick (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN flip_kick_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.flip_kick;
|
||||
|
||||
|
@ -18,6 +18,7 @@ CREATE TABLE maker.frob (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN frob_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.frob;
|
||||
|
||||
|
@ -11,5 +11,6 @@ CREATE TABLE maker.price_feeds (
|
||||
UNIQUE (header_id, medianizer_address, tx_idx, log_idx)
|
||||
);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.price_feeds;
|
@ -18,6 +18,7 @@ CREATE TABLE maker.bite (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN bite_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.bite;
|
||||
|
||||
|
@ -42,6 +42,7 @@ ALTER TABLE public.checked_headers
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN pit_file_stability_fee_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.pit_file_ilk;
|
||||
DROP TABLE maker.pit_file_stability_fee;
|
||||
|
@ -12,6 +12,7 @@ CREATE TABLE maker.vat_init (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN vat_init_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vat_init;
|
||||
|
||||
|
@ -42,6 +42,7 @@ ALTER TABLE public.checked_headers
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN drip_file_vow_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.drip_file_ilk;
|
||||
DROP TABLE maker.drip_file_repo;
|
||||
|
@ -1,4 +1,5 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE OR REPLACE FUNCTION notify_pricefeed() RETURNS trigger AS $$
|
||||
BEGIN
|
||||
PERFORM pg_notify(
|
||||
@ -8,6 +9,7 @@ BEGIN
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
-- +goose StatementEnd
|
||||
|
||||
CREATE TRIGGER notify_pricefeeds
|
||||
AFTER INSERT ON maker.price_feeds
|
||||
|
@ -12,6 +12,7 @@ CREATE TABLE maker.drip_drip (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN drip_drip_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.drip_drip;
|
||||
|
||||
|
@ -43,6 +43,7 @@ ALTER TABLE public.checked_headers
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN cat_file_pit_vow_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.cat_file_chop_lump;
|
||||
DROP TABLE maker.cat_file_flip;
|
||||
|
@ -16,6 +16,7 @@ CREATE TABLE maker.flop_kick (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN flop_kick_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.flop_kick;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
@ -14,6 +14,7 @@ CREATE TABLE maker.vat_toll (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN vat_toll_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vat_toll;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
@ -17,6 +17,7 @@ CREATE TABLE maker.vat_tune (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN vat_tune_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vat_tune;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
@ -17,6 +17,7 @@ CREATE TABLE maker.vat_grab (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN vat_grab_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vat_grab;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
@ -14,6 +14,7 @@ CREATE TABLE maker.vat_slip (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN vat_slip_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vat_slip;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
@ -12,6 +12,7 @@ CREATE TABLE maker.vow_flog (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN vow_flog_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vow_flog;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
@ -16,6 +16,7 @@ CREATE TABLE maker.flap_kick (
|
||||
ALTER TABLE public.checked_headers
|
||||
ADD COLUMN flap_kick_checked BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.flap_kick;
|
||||
ALTER TABLE public.checked_headers
|
||||
|
Loading…
Reference in New Issue
Block a user