Change migration timestamp from epoch to yyyymmddhhmmss

This commit is contained in:
Edvard 2019-01-22 13:15:29 +01:00
parent d7dde86942
commit 0a96a366d3
169 changed files with 817 additions and 576 deletions

View File

@ -1 +0,0 @@
DROP TABLE public.blocks

View File

@ -1,4 +0,0 @@
CREATE TABLE public.blocks
(
block_number BIGINT
)

View File

@ -1,5 +0,0 @@
ALTER TABLE blocks
DROP COLUMN block_gaslimit,
DROP COLUMN block_gasused,
DROP COLUMN block_time;

View File

@ -1 +0,0 @@
DROP TABLE transactions

View File

@ -1 +0,0 @@
ALTER TABLE blocks DROP id

View File

@ -1 +0,0 @@
ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY

View File

@ -1,2 +0,0 @@
ALTER TABLE transactions
DROP COLUMN block_id

View File

@ -1 +0,0 @@
DROP INDEX block_number_index;

View File

@ -1 +0,0 @@
CREATE INDEX block_number_index ON blocks (block_number);

View File

@ -1,7 +0,0 @@
ALTER TABLE blocks
Drop COLUMN block_difficulty,
Drop COLUMN block_hash,
drop COLUMN block_nonce,
drop COLUMN block_parenthash,
drop COLUMN block_size,
drop COLUMN uncle_hash

View File

@ -1 +0,0 @@
DROP TABLE watched_contracts

View File

@ -1,2 +0,0 @@
ALTER TABLE transactions
DROP COLUMN tx_from

View File

@ -1,2 +0,0 @@
ALTER TABLE transactions
ADD COLUMN tx_from VARCHAR(66)

View File

@ -1,2 +0,0 @@
ALTER TABLE watched_contracts
DROP COLUMN contract_abi;

View File

@ -1,2 +0,0 @@
ALTER TABLE watched_contracts
ADD COLUMN contract_abi json;

View File

@ -1 +0,0 @@
DROP TABLE nodes;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
DROP COLUMN node_id;

View File

@ -1,5 +0,0 @@
ALTER TABLE blocks
ADD COLUMN node_id INTEGER NOT NULL,
ADD CONSTRAINT node_fk
FOREIGN KEY (node_id)
REFERENCES nodes (id);

View File

@ -1,2 +0,0 @@
ALTER TABLE watched_contracts
DROP CONSTRAINT contract_hash_uc;

View File

@ -1,2 +0,0 @@
ALTER TABLE watched_contracts
ADD CONSTRAINT contract_hash_uc UNIQUE (contract_hash);

View File

@ -1 +0,0 @@
DROP TABLE logs;

View File

@ -1,11 +0,0 @@
BEGIN;
ALTER TABLE transactions
DROP CONSTRAINT blocks_fk;
ALTER TABLE transactions
ADD CONSTRAINT fk_test
FOREIGN KEY (block_id)
REFERENCES blocks (id);
COMMIT;

View File

@ -1,12 +0,0 @@
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;

View File

@ -1,12 +0,0 @@
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;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
DROP COLUMN is_final;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
ADD COLUMN is_final BOOLEAN;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
DROP CONSTRAINT node_id_block_number_uc;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
ADD CONSTRAINT node_id_block_number_uc UNIQUE (block_number, node_id);

View File

@ -1 +0,0 @@
DROP INDEX block_id_index;

View File

@ -1 +0,0 @@
CREATE INDEX block_id_index ON transactions (block_id);

View File

@ -1 +0,0 @@
DROP INDEX node_id_index;

View File

@ -1 +0,0 @@
CREATE INDEX node_id_index ON blocks (node_id);

View File

@ -1 +0,0 @@
DROP INDEX tx_to_index;

View File

@ -1 +0,0 @@
CREATE INDEX tx_to_index ON transactions(tx_to);

View File

@ -1 +0,0 @@
DROP INDEX tx_from_index;

View File

@ -1 +0,0 @@
CREATE INDEX tx_from_index ON transactions(tx_from);

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
DROP COLUMN block_miner;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
ADD COLUMN block_miner VARCHAR(42);

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
DROP COLUMN block_extra_data;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
ADD COLUMN block_extra_data VARCHAR;

View File

@ -1,3 +0,0 @@
ALTER TABLE blocks
DROP COLUMN block_reward,
DROP COLUMN block_uncles_reward;

View File

@ -1,3 +0,0 @@
ALTER TABLE blocks
ADD COLUMN block_reward NUMERIC,
ADD COLUMN block_uncles_reward NUMERIC;

View File

@ -1,2 +0,0 @@
ALTER TABLE transactions
DROP COLUMN tx_input_data;

View File

@ -1,2 +0,0 @@
ALTER TABLE transactions
ADD COLUMN tx_input_data VARCHAR;

View File

@ -1,2 +0,0 @@
DROP TABLE receipts;

View File

@ -1 +0,0 @@
DROP INDEX transaction_id_index;

View File

@ -1 +0,0 @@
CREATE INDEX transaction_id_index ON receipts (transaction_id);

View File

@ -1,3 +0,0 @@
ALTER TABLE nodes
DROP COLUMN node_id,
DROP COLUMN client_name;

View File

@ -1,3 +0,0 @@
ALTER TABLE nodes
ADD COLUMN node_id VARCHAR(128),
ADD COLUMN client_name VARCHAR;

View File

@ -1,9 +0,0 @@
BEGIN;
ALTER TABLE nodes
DROP CONSTRAINT node_uc;
ALTER TABLE nodes
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id);
COMMIT;

View File

@ -1,9 +0,0 @@
BEGIN;
ALTER TABLE nodes
DROP CONSTRAINT node_uc;
ALTER TABLE nodes
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id);
COMMIT;

View File

@ -1,12 +0,0 @@
BEGIN;
ALTER TABLE logs
DROP CONSTRAINT receipts_fk;
ALTER TABLE logs
DROP COLUMN receipt_id;
ALTER TABLE logs
ADD CONSTRAINT log_uc UNIQUE (block_number, index);
COMMIT;

View File

@ -1 +0,0 @@
DROP TABLE log_filters;

View File

@ -1,2 +0,0 @@
DROP VIEW watched_event_logs;
DROP VIEW block_stats;

View File

@ -1,17 +0,0 @@
BEGIN;
ALTER TABLE blocks
ALTER COLUMN block_gaslimit TYPE DOUBLE PRECISION USING block_gaslimit :: DOUBLE PRECISION;
ALTER TABLE blocks
ALTER COLUMN block_gasused TYPE DOUBLE PRECISION USING block_gasused :: DOUBLE PRECISION;
ALTER TABLE blocks
ALTER COLUMN block_time TYPE DOUBLE PRECISION USING block_time :: DOUBLE PRECISION;
ALTER TABLE blocks
ALTER COLUMN block_reward TYPE NUMERIC USING block_time :: NUMERIC;
ALTER TABLE blocks
ALTER COLUMN block_uncles_reward TYPE NUMERIC USING block_time :: NUMERIC;
COMMIT;

View File

@ -1,17 +0,0 @@
BEGIN;
ALTER TABLE blocks
ALTER COLUMN block_gaslimit TYPE BIGINT USING block_gaslimit :: BIGINT;
ALTER TABLE blocks
ALTER COLUMN block_gasused TYPE BIGINT USING block_gasused :: BIGINT;
ALTER TABLE blocks
ALTER COLUMN block_time TYPE BIGINT USING block_time :: BIGINT;
ALTER TABLE blocks
ALTER COLUMN block_reward TYPE DOUBLE PRECISION USING block_time :: DOUBLE PRECISION;
ALTER TABLE blocks
ALTER COLUMN block_uncles_reward TYPE DOUBLE PRECISION USING block_time :: DOUBLE PRECISION;
COMMIT;

View File

@ -1,40 +0,0 @@
BEGIN;
ALTER TABLE blocks
RENAME COLUMN number TO block_number;
ALTER TABLE blocks
RENAME COLUMN gaslimit TO block_gaslimit;
ALTER TABLE blocks
RENAME COLUMN gasused TO block_gasused;
ALTER TABLE blocks
RENAME COLUMN TIME TO block_time;
ALTER TABLE blocks
RENAME COLUMN difficulty TO block_difficulty;
ALTER TABLE blocks
RENAME COLUMN HASH TO block_hash;
ALTER TABLE blocks
RENAME COLUMN nonce TO block_nonce;
ALTER TABLE blocks
RENAME COLUMN parenthash TO block_parenthash;
ALTER TABLE blocks
RENAME COLUMN size TO block_size;
ALTER TABLE blocks
RENAME COLUMN miner TO block_miner;
ALTER TABLE blocks
RENAME COLUMN extra_data TO block_extra_data;
ALTER TABLE blocks
RENAME COLUMN reward TO block_reward;
ALTER TABLE blocks
RENAME COLUMN uncles_reward TO block_uncles_reward;
COMMIT;

View File

@ -1,50 +0,0 @@
BEGIN;
ALTER TABLE blocks
RENAME COLUMN block_number TO number;
ALTER TABLE blocks
RENAME COLUMN block_gaslimit TO gaslimit;
ALTER TABLE blocks
RENAME COLUMN block_gasused TO gasused;
ALTER TABLE blocks
RENAME COLUMN block_time TO time;
ALTER TABLE blocks
RENAME COLUMN block_difficulty TO difficulty;
ALTER TABLE blocks
RENAME COLUMN block_hash TO hash;
ALTER TABLE blocks
RENAME COLUMN block_nonce TO nonce;
ALTER TABLE blocks
RENAME COLUMN block_parenthash TO parenthash;
ALTER TABLE blocks
RENAME COLUMN block_size TO size;
ALTER TABLE blocks
RENAME COLUMN block_miner TO miner;
ALTER TABLE blocks
RENAME COLUMN block_extra_data TO extra_data;
ALTER TABLE blocks
RENAME COLUMN block_reward TO reward;
ALTER TABLE blocks
RENAME COLUMN block_uncles_reward TO uncles_reward;
COMMIT;

View File

@ -1,19 +0,0 @@
BEGIN;
ALTER TABLE transactions
RENAME COLUMN hash TO tx_hash;
ALTER TABLE transactions
RENAME COLUMN nonce TO tx_nonce;
ALTER TABLE transactions
RENAME COLUMN gaslimit TO tx_gaslimit;
ALTER TABLE transactions
RENAME COLUMN gasprice TO tx_gasprice;
ALTER TABLE transactions
RENAME COLUMN value TO tx_value;
ALTER TABLE transactions
RENAME COLUMN input_data TO tx_input_data;
COMMIT;

View File

@ -1,19 +0,0 @@
BEGIN;
ALTER TABLE transactions
RENAME COLUMN tx_hash TO hash;
ALTER TABLE transactions
RENAME COLUMN tx_nonce TO nonce;
ALTER TABLE transactions
RENAME COLUMN tx_gaslimit TO gaslimit;
ALTER TABLE transactions
RENAME COLUMN tx_gasprice TO gasprice;
ALTER TABLE transactions
RENAME COLUMN tx_value TO value;
ALTER TABLE transactions
RENAME COLUMN tx_input_data TO input_data;
COMMIT;

View File

@ -1,7 +0,0 @@
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;

View File

@ -1,7 +0,0 @@
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;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
ALTER COLUMN size TYPE BIGINT USING size::BIGINT;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
ALTER COLUMN size TYPE VARCHAR USING size::VARCHAR;

View File

@ -1,23 +0,0 @@
BEGIN;
ALTER TABLE public.eth_nodes
RENAME TO nodes;
ALTER TABLE public.nodes
RENAME COLUMN eth_node_id TO node_id;
ALTER TABLE public.nodes
DROP CONSTRAINT eth_node_uc;
ALTER TABLE public.nodes
ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id);
ALTER TABLE public.blocks RENAME COLUMN eth_node_id TO node_id;
ALTER TABLE public.blocks DROP CONSTRAINT eth_node_id_block_number_uc;
ALTER TABLE public.blocks
ADD CONSTRAINT node_id_block_number_uc UNIQUE (number, node_id);
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;

View File

@ -1,21 +0,0 @@
BEGIN;
ALTER TABLE public.nodes RENAME TO eth_nodes;
ALTER TABLE public.eth_nodes RENAME COLUMN node_id TO eth_node_id;
ALTER TABLE public.eth_nodes DROP CONSTRAINT node_uc;
ALTER TABLE public.eth_nodes
ADD CONSTRAINT eth_node_uc UNIQUE (genesis_block, network_id, eth_node_id);
ALTER TABLE public.blocks RENAME COLUMN node_id TO eth_node_id;
ALTER TABLE public.blocks DROP CONSTRAINT node_id_block_number_uc;
ALTER TABLE public.blocks
ADD CONSTRAINT eth_node_id_block_number_uc UNIQUE (number, eth_node_id);
ALTER TABLE public.blocks DROP CONSTRAINT node_fk;
ALTER TABLE public.blocks
ADD CONSTRAINT node_fk
FOREIGN KEY (eth_node_id) REFERENCES eth_nodes (id) ON DELETE CASCADE;
COMMIT;

View File

@ -1,25 +0,0 @@
BEGIN;
ALTER TABLE receipts
ADD COLUMN transaction_id INT;
CREATE INDEX transaction_id_index ON receipts (transaction_id);
UPDATE receipts
SET transaction_id = (
SELECT id FROM transactions WHERE transactions.hash = receipts.tx_hash
);
ALTER TABLE receipts
ALTER COLUMN transaction_id SET NOT NULL;
ALTER TABLE receipts
ADD CONSTRAINT transaction_fk
FOREIGN KEY (transaction_id)
REFERENCES transactions (id)
ON DELETE CASCADE;
ALTER TABLE receipts
DROP COLUMN block_id;
COMMIT;

View File

@ -1,23 +0,0 @@
BEGIN;
ALTER TABLE receipts
ADD COLUMN block_id INT;
UPDATE receipts
SET block_id = (
SELECT block_id FROM transactions WHERE transactions.id = receipts.transaction_id
);
ALTER TABLE receipts
ALTER COLUMN block_id SET NOT NULL;
ALTER TABLE receipts
ADD CONSTRAINT blocks_fk
FOREIGN KEY (block_id)
REFERENCES blocks (id)
ON DELETE CASCADE;
ALTER TABLE receipts
DROP COLUMN transaction_id;
COMMIT;

View File

@ -1,2 +0,0 @@
ALTER TABLE blocks
DROP COLUMN eth_node_fingerprint;

View File

@ -1 +0,0 @@
DROP TABLE token_supply;

View File

@ -1 +0,0 @@
DROP TABLE public.headers;

View File

@ -1 +0,0 @@
DROP TABLE public.checked_headers;

View File

@ -1 +0,0 @@
DROP SCHEMA maker;

View File

@ -1,2 +0,0 @@
CREATE SCHEMA maker;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.flip_kick;
ALTER TABLE public.checked_headers
DROP COLUMN flip_kick_checked;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.frob;
ALTER TABLE public.checked_headers
DROP COLUMN frob_checked;

View File

@ -1 +0,0 @@
DROP TABLE maker.price_feeds;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.tend;
ALTER TABLE public.checked_headers
DROP COLUMN tend_checked;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.bite;
ALTER TABLE public.checked_headers
DROP COLUMN bite_checked;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.dent;
ALTER TABLE public.checked_headers
DROP COLUMN dent_checked;

View File

@ -1,12 +0,0 @@
DROP TABLE maker.pit_file_ilk;
DROP TABLE maker.pit_file_stability_fee;
DROP TABLE maker.pit_file_debt_ceiling;
ALTER TABLE public.checked_headers
DROP COLUMN pit_file_debt_ceiling_checked;
ALTER TABLE public.checked_headers
DROP COLUMN pit_file_ilk_checked;
ALTER TABLE public.checked_headers
DROP COLUMN pit_file_stability_fee_checked;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.vat_init;
ALTER TABLE public.checked_headers
DROP COLUMN vat_init_checked;

View File

@ -1,12 +0,0 @@
DROP TABLE maker.drip_file_ilk;
DROP TABLE maker.drip_file_repo;
DROP TABLE maker.drip_file_vow;
ALTER TABLE public.checked_headers
DROP COLUMN drip_file_ilk_checked;
ALTER TABLE public.checked_headers
DROP COLUMN drip_file_repo_checked;
ALTER TABLE public.checked_headers
DROP COLUMN drip_file_vow_checked;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.deal;
ALTER TABLE public.checked_headers
DROP COLUMN deal_checked;

View File

@ -1 +0,0 @@
DROP TRIGGER notify_pricefeeds ON maker.price_feeds;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.drip_drip;
ALTER TABLE public.checked_headers
DROP COLUMN drip_drip_checked;

View File

@ -1,12 +0,0 @@
DROP TABLE maker.cat_file_chop_lump;
DROP TABLE maker.cat_file_flip;
DROP TABLE maker.cat_file_pit_vow;
ALTER TABLE public.checked_headers
DROP COLUMN cat_file_chop_lump_checked;
ALTER TABLE public.checked_headers
DROP COLUMN cat_file_flip_checked;
ALTER TABLE public.checked_headers
DROP COLUMN cat_file_pit_vow_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.flop_kick;
ALTER TABLE public.checked_headers
DROP COLUMN flop_kick_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_move;
ALTER TABLE public.checked_headers
DROP COLUMN vat_move_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_fold;
ALTER TABLE public.checked_headers
DROP COLUMN vat_fold_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_heal;
ALTER TABLE public.checked_headers
DROP COLUMN vat_heal_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_toll;
ALTER TABLE public.checked_headers
DROP COLUMN vat_toll_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_tune;
ALTER TABLE public.checked_headers
DROP COLUMN vat_tune_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_grab;
ALTER TABLE public.checked_headers
DROP COLUMN vat_grab_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_flux;
ALTER TABLE public.checked_headers
DROP COLUMN vat_flux_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vat_slip;
ALTER TABLE public.checked_headers
DROP COLUMN vat_slip_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.vow_flog;
ALTER TABLE public.checked_headers
DROP COLUMN vow_flog_checked;

View File

@ -1,3 +0,0 @@
DROP TABLE maker.flap_kick;
ALTER TABLE public.checked_headers
DROP COLUMN flap_kick_checked;

View File

@ -1,4 +0,0 @@
DROP TABLE maker.pit_file_stability_fee;
ALTER TABLE public.checked_headers
DROP COLUMN pit_file_stability_fee_checked;

View File

@ -0,0 +1,9 @@
-- +goose Up
CREATE TABLE public.blocks
(
block_number BIGINT
)
-- +goose Down
DROP TABLE public.blocks

Some files were not shown because too many files have changed in this diff Show More