From 8de6fc45e1149a74db22c86ea3360b279c433095 Mon Sep 17 00:00:00 2001 From: Edvard Date: Tue, 22 Jan 2019 15:07:11 +0100 Subject: [PATCH] Remove tx from migrations (goose does it automagically) --- db/migrations/00001_create_blocks_table.sql | 4 ++-- db/migrations/00003_initial_transaction_table.sql | 4 ++-- db/migrations/00004_add_primary_key_to_blocks.sql | 4 ++-- .../00005_add_block_id_to_transactions.sql | 4 ++-- db/migrations/00006_add_block_index.sql | 2 +- db/migrations/00007_add_blocks_columns.sql | 4 ++-- db/migrations/00008_add_contracts_table.sql | 4 ++-- db/migrations/00009_add_from_to_transactions.sql | 4 ++-- .../00010_add_abi_to_watched_contracts.sql | 2 +- db/migrations/00011_add_nodes_table.sql | 2 +- db/migrations/00012_add_node_fk_to_blocks.sql | 2 +- ...ntract_hash_constraint_to_watched_contracts.sql | 2 +- db/migrations/00014_add_logs_table.sql | 2 +- .../00015_add_cascade_delete_to_transactions.sql | 8 -------- .../00016_add_cascade_delete_to_blocks.sql | 8 -------- db/migrations/00017_add_is_final_to_blocks.sql | 2 +- .../00018_add_unique_constraint_blocks_node.sql | 2 +- ...19_add_block_id_index_on_transactions_table.sql | 2 +- .../00020_add_node_id_index_on_blocks_table.sql | 2 +- db/migrations/00021_tx_to_index.sql | 2 +- db/migrations/00022_tx_from_index.sql | 2 +- db/migrations/00023_add_miner.sql | 2 +- db/migrations/00024_add_extra_data.sql | 2 +- .../00026_add_data_input_to_transactions.sql | 2 +- db/migrations/00027_create_receipts_table.sql | 3 --- db/migrations/00029_add_fields_to_node.sql | 2 +- db/migrations/00030_update_node_index.sql | 8 -------- db/migrations/00031_add_log_fk_constraint.sql | 6 ------ db/migrations/00032_add_log_filters.sql | 2 +- db/migrations/00034_update_gas_limit_gas_used.sql | 7 ------- db/migrations/00035_rename_block_columns.sql | 14 -------------- db/migrations/00036_update_tx_table_names.sql | 5 ----- ...0037_update_log_filters_to_block_constraint.sql | 5 ----- db/migrations/00038_update_eth18_types.sql | 1 - db/migrations/00039_rename_node_table.sql | 4 ---- .../00040_associate_receipts_with_blocks.sql | 8 -------- .../00041_add_eth_node_fingerprint_to_blocks.sql | 5 +---- db/migrations/00042_create_token_supply_table.sql | 5 ++--- db/migrations/00043_create_headers_table.sql | 3 ++- .../00044_create_checked_headers_table.sql | 2 +- db/migrations/00045_create_maker_schema.sql | 1 - db/migrations/00046_create_flip_kick.sql | 3 ++- db/migrations/00047_create_frob.sql | 3 ++- db/migrations/00048_create_price_feeds_table.sql | 3 ++- db/migrations/00049_create_tend.sql | 2 +- db/migrations/00050_create_bite.sql | 3 ++- db/migrations/00052_create_pit_file.sql | 3 ++- db/migrations/00053_create_vat_init.sql | 1 + db/migrations/00054_create_drip_file.sql | 3 ++- db/migrations/00055_create_deal.sql | 2 +- db/migrations/00056_add_price_feed_trigger.sql | 2 ++ db/migrations/00057_create_drip_drip.sql | 3 ++- db/migrations/00058_create_cat_file.sql | 3 ++- db/migrations/00059_create_flop_kick.sql | 3 ++- db/migrations/00060_create_vat_move.sql | 2 +- db/migrations/00063_create_vat_toll.sql | 3 ++- db/migrations/00064_create_vat_tune.sql | 3 ++- db/migrations/00065_create_vat_grab.sql | 3 ++- db/migrations/00067_create_vat_slip.sql | 3 ++- db/migrations/00068_create_vow_flog.sql | 3 ++- db/migrations/00069_create_flap_kick.sql | 3 ++- .../00070_drop_pit_file_stability_fee.sql | 2 +- 62 files changed, 74 insertions(+), 137 deletions(-) diff --git a/db/migrations/00001_create_blocks_table.sql b/db/migrations/00001_create_blocks_table.sql index 3e42ae83..f5fe43a6 100644 --- a/db/migrations/00001_create_blocks_table.sql +++ b/db/migrations/00001_create_blocks_table.sql @@ -2,8 +2,8 @@ CREATE TABLE public.blocks ( block_number BIGINT -) +); -- +goose Down -DROP TABLE public.blocks +DROP TABLE public.blocks; diff --git a/db/migrations/00003_initial_transaction_table.sql b/db/migrations/00003_initial_transaction_table.sql index e4cfafe5..ba6b06a0 100644 --- a/db/migrations/00003_initial_transaction_table.sql +++ b/db/migrations/00003_initial_transaction_table.sql @@ -8,7 +8,7 @@ CREATE TABLE transactions tx_gaslimit NUMERIC, tx_gasprice NUMERIC, tx_value NUMERIC -) +); -- +goose Down -DROP TABLE transactions \ No newline at end of file +DROP TABLE transactions; diff --git a/db/migrations/00004_add_primary_key_to_blocks.sql b/db/migrations/00004_add_primary_key_to_blocks.sql index 274cd918..0f336243 100644 --- a/db/migrations/00004_add_primary_key_to_blocks.sql +++ b/db/migrations/00004_add_primary_key_to_blocks.sql @@ -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 \ No newline at end of file +ALTER TABLE blocks DROP id; diff --git a/db/migrations/00005_add_block_id_to_transactions.sql b/db/migrations/00005_add_block_id_to_transactions.sql index 7e782019..08e5002a 100644 --- a/db/migrations/00005_add_block_id_to_transactions.sql +++ b/db/migrations/00005_add_block_id_to_transactions.sql @@ -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 \ No newline at end of file + DROP COLUMN block_id; diff --git a/db/migrations/00006_add_block_index.sql b/db/migrations/00006_add_block_index.sql index 3dde5477..e04815ee 100644 --- a/db/migrations/00006_add_block_index.sql +++ b/db/migrations/00006_add_block_index.sql @@ -3,4 +3,4 @@ CREATE INDEX block_number_index ON blocks (block_number); -- +goose Down -DROP INDEX block_number_index; \ No newline at end of file +DROP INDEX block_number_index; diff --git a/db/migrations/00007_add_blocks_columns.sql b/db/migrations/00007_add_blocks_columns.sql index 0cca77a5..f12c6a5d 100644 --- a/db/migrations/00007_add_blocks_columns.sql +++ b/db/migrations/00007_add_blocks_columns.sql @@ -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 \ No newline at end of file + drop COLUMN uncle_hash; diff --git a/db/migrations/00008_add_contracts_table.sql b/db/migrations/00008_add_contracts_table.sql index 71d263f5..d5016555 100644 --- a/db/migrations/00008_add_contracts_table.sql +++ b/db/migrations/00008_add_contracts_table.sql @@ -3,7 +3,7 @@ CREATE TABLE watched_contracts ( contract_id SERIAL PRIMARY KEY, contract_hash VARCHAR(66) -) +); -- +goose Down -DROP TABLE watched_contracts \ No newline at end of file +DROP TABLE watched_contracts; diff --git a/db/migrations/00009_add_from_to_transactions.sql b/db/migrations/00009_add_from_to_transactions.sql index 26c765e2..3311b7e4 100644 --- a/db/migrations/00009_add_from_to_transactions.sql +++ b/db/migrations/00009_add_from_to_transactions.sql @@ -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; diff --git a/db/migrations/00010_add_abi_to_watched_contracts.sql b/db/migrations/00010_add_abi_to_watched_contracts.sql index 5146a059..4520b9b7 100644 --- a/db/migrations/00010_add_abi_to_watched_contracts.sql +++ b/db/migrations/00010_add_abi_to_watched_contracts.sql @@ -4,4 +4,4 @@ ALTER TABLE watched_contracts -- +goose Down ALTER TABLE watched_contracts - DROP COLUMN contract_abi; \ No newline at end of file + DROP COLUMN contract_abi; diff --git a/db/migrations/00011_add_nodes_table.sql b/db/migrations/00011_add_nodes_table.sql index 86da63e5..46f1d51d 100644 --- a/db/migrations/00011_add_nodes_table.sql +++ b/db/migrations/00011_add_nodes_table.sql @@ -7,4 +7,4 @@ CREATE TABLE nodes ( ); -- +goose Down -DROP TABLE nodes; \ No newline at end of file +DROP TABLE nodes; diff --git a/db/migrations/00012_add_node_fk_to_blocks.sql b/db/migrations/00012_add_node_fk_to_blocks.sql index 9af8bb37..6f658caa 100644 --- a/db/migrations/00012_add_node_fk_to_blocks.sql +++ b/db/migrations/00012_add_node_fk_to_blocks.sql @@ -7,4 +7,4 @@ REFERENCES nodes (id); -- +goose Down ALTER TABLE blocks - DROP COLUMN node_id; \ No newline at end of file + DROP COLUMN node_id; diff --git a/db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql b/db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql index d3ff3158..4f252cce 100644 --- a/db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql +++ b/db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql @@ -5,4 +5,4 @@ ALTER TABLE watched_contracts -- +goose Down ALTER TABLE watched_contracts - DROP CONSTRAINT contract_hash_uc; \ No newline at end of file + DROP CONSTRAINT contract_hash_uc; diff --git a/db/migrations/00014_add_logs_table.sql b/db/migrations/00014_add_logs_table.sql index c269fc07..f85d35bd 100644 --- a/db/migrations/00014_add_logs_table.sql +++ b/db/migrations/00014_add_logs_table.sql @@ -16,4 +16,4 @@ CREATE TABLE logs ( -- +goose Down -DROP TABLE logs; \ No newline at end of file +DROP TABLE logs; diff --git a/db/migrations/00015_add_cascade_delete_to_transactions.sql b/db/migrations/00015_add_cascade_delete_to_transactions.sql index 7d833d19..f10d52dd 100644 --- a/db/migrations/00015_add_cascade_delete_to_transactions.sql +++ b/db/migrations/00015_add_cascade_delete_to_transactions.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00016_add_cascade_delete_to_blocks.sql b/db/migrations/00016_add_cascade_delete_to_blocks.sql index 1b4a2939..5a0a7e5f 100644 --- a/db/migrations/00016_add_cascade_delete_to_blocks.sql +++ b/db/migrations/00016_add_cascade_delete_to_blocks.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00017_add_is_final_to_blocks.sql b/db/migrations/00017_add_is_final_to_blocks.sql index 21f5b7ad..bbb27d55 100644 --- a/db/migrations/00017_add_is_final_to_blocks.sql +++ b/db/migrations/00017_add_is_final_to_blocks.sql @@ -4,4 +4,4 @@ ALTER TABLE blocks -- +goose Down ALTER TABLE blocks - DROP COLUMN is_final; \ No newline at end of file + DROP COLUMN is_final; diff --git a/db/migrations/00018_add_unique_constraint_blocks_node.sql b/db/migrations/00018_add_unique_constraint_blocks_node.sql index 6fd23743..e66e345f 100644 --- a/db/migrations/00018_add_unique_constraint_blocks_node.sql +++ b/db/migrations/00018_add_unique_constraint_blocks_node.sql @@ -4,4 +4,4 @@ ALTER TABLE blocks -- +goose Down ALTER TABLE blocks - DROP CONSTRAINT node_id_block_number_uc; \ No newline at end of file + DROP CONSTRAINT node_id_block_number_uc; diff --git a/db/migrations/00019_add_block_id_index_on_transactions_table.sql b/db/migrations/00019_add_block_id_index_on_transactions_table.sql index feaa1882..318cc9be 100644 --- a/db/migrations/00019_add_block_id_index_on_transactions_table.sql +++ b/db/migrations/00019_add_block_id_index_on_transactions_table.sql @@ -2,4 +2,4 @@ CREATE INDEX block_id_index ON transactions (block_id); -- +goose Down -DROP INDEX block_id_index; \ No newline at end of file +DROP INDEX block_id_index; diff --git a/db/migrations/00020_add_node_id_index_on_blocks_table.sql b/db/migrations/00020_add_node_id_index_on_blocks_table.sql index 915ef645..bab71f97 100644 --- a/db/migrations/00020_add_node_id_index_on_blocks_table.sql +++ b/db/migrations/00020_add_node_id_index_on_blocks_table.sql @@ -2,4 +2,4 @@ CREATE INDEX node_id_index ON blocks (node_id); -- +goose Down -DROP INDEX node_id_index; \ No newline at end of file +DROP INDEX node_id_index; diff --git a/db/migrations/00021_tx_to_index.sql b/db/migrations/00021_tx_to_index.sql index 78139346..fa50de5e 100644 --- a/db/migrations/00021_tx_to_index.sql +++ b/db/migrations/00021_tx_to_index.sql @@ -2,4 +2,4 @@ CREATE INDEX tx_to_index ON transactions(tx_to); -- +goose Down -DROP INDEX tx_to_index; \ No newline at end of file +DROP INDEX tx_to_index; diff --git a/db/migrations/00022_tx_from_index.sql b/db/migrations/00022_tx_from_index.sql index a4a9b76c..6d052bae 100644 --- a/db/migrations/00022_tx_from_index.sql +++ b/db/migrations/00022_tx_from_index.sql @@ -2,4 +2,4 @@ CREATE INDEX tx_from_index ON transactions(tx_from); -- +goose Down -DROP INDEX tx_from_index; \ No newline at end of file +DROP INDEX tx_from_index; diff --git a/db/migrations/00023_add_miner.sql b/db/migrations/00023_add_miner.sql index f55ae6e6..da1e120a 100644 --- a/db/migrations/00023_add_miner.sql +++ b/db/migrations/00023_add_miner.sql @@ -4,4 +4,4 @@ ALTER TABLE blocks -- +goose Down ALTER TABLE blocks - DROP COLUMN block_miner; \ No newline at end of file + DROP COLUMN block_miner; diff --git a/db/migrations/00024_add_extra_data.sql b/db/migrations/00024_add_extra_data.sql index 7aabca52..66ff016b 100644 --- a/db/migrations/00024_add_extra_data.sql +++ b/db/migrations/00024_add_extra_data.sql @@ -4,4 +4,4 @@ ALTER TABLE blocks -- +goose Down ALTER TABLE blocks - DROP COLUMN block_extra_data; \ No newline at end of file + DROP COLUMN block_extra_data; diff --git a/db/migrations/00026_add_data_input_to_transactions.sql b/db/migrations/00026_add_data_input_to_transactions.sql index 549cec6c..454dfa16 100644 --- a/db/migrations/00026_add_data_input_to_transactions.sql +++ b/db/migrations/00026_add_data_input_to_transactions.sql @@ -4,4 +4,4 @@ ALTER TABLE transactions -- +goose Down ALTER TABLE transactions - DROP COLUMN tx_input_data; \ No newline at end of file + DROP COLUMN tx_input_data; diff --git a/db/migrations/00027_create_receipts_table.sql b/db/migrations/00027_create_receipts_table.sql index 686a6d9b..53ef4276 100644 --- a/db/migrations/00027_create_receipts_table.sql +++ b/db/migrations/00027_create_receipts_table.sql @@ -15,8 +15,5 @@ CREATE TABLE receipts ); - - -- +goose Down DROP TABLE receipts; - diff --git a/db/migrations/00029_add_fields_to_node.sql b/db/migrations/00029_add_fields_to_node.sql index f5383880..b4dc223f 100644 --- a/db/migrations/00029_add_fields_to_node.sql +++ b/db/migrations/00029_add_fields_to_node.sql @@ -6,4 +6,4 @@ ALTER TABLE nodes -- +goose Down ALTER TABLE nodes DROP COLUMN node_id, - DROP COLUMN client_name; \ No newline at end of file + DROP COLUMN client_name; diff --git a/db/migrations/00030_update_node_index.sql b/db/migrations/00030_update_node_index.sql index c783b04f..02ad2b2d 100644 --- a/db/migrations/00030_update_node_index.sql +++ b/db/migrations/00030_update_node_index.sql @@ -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; diff --git a/db/migrations/00031_add_log_fk_constraint.sql b/db/migrations/00031_add_log_fk_constraint.sql index 22cae14e..a31701b1 100644 --- a/db/migrations/00031_add_log_fk_constraint.sql +++ b/db/migrations/00031_add_log_fk_constraint.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00032_add_log_filters.sql b/db/migrations/00032_add_log_filters.sql index 371d3d70..0367f5e5 100644 --- a/db/migrations/00032_add_log_filters.sql +++ b/db/migrations/00032_add_log_filters.sql @@ -13,4 +13,4 @@ CREATE TABLE log_filters ( ); -- +goose Down -DROP TABLE log_filters; \ No newline at end of file +DROP TABLE log_filters; diff --git a/db/migrations/00034_update_gas_limit_gas_used.sql b/db/migrations/00034_update_gas_limit_gas_used.sql index 798977fe..276de18e 100644 --- a/db/migrations/00034_update_gas_limit_gas_used.sql +++ b/db/migrations/00034_update_gas_limit_gas_used.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00035_rename_block_columns.sql b/db/migrations/00035_rename_block_columns.sql index e0645838..d093ddb4 100644 --- a/db/migrations/00035_rename_block_columns.sql +++ b/db/migrations/00035_rename_block_columns.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00036_update_tx_table_names.sql b/db/migrations/00036_update_tx_table_names.sql index 8c463907..41848828 100644 --- a/db/migrations/00036_update_tx_table_names.sql +++ b/db/migrations/00036_update_tx_table_names.sql @@ -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; diff --git a/db/migrations/00037_update_log_filters_to_block_constraint.sql b/db/migrations/00037_update_log_filters_to_block_constraint.sql index 025d681e..512a44db 100644 --- a/db/migrations/00037_update_log_filters_to_block_constraint.sql +++ b/db/migrations/00037_update_log_filters_to_block_constraint.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00038_update_eth18_types.sql b/db/migrations/00038_update_eth18_types.sql index b81f5980..3389d1aa 100644 --- a/db/migrations/00038_update_eth18_types.sql +++ b/db/migrations/00038_update_eth18_types.sql @@ -4,6 +4,5 @@ ALTER TABLE blocks -- +goose Down --- +goose Up ALTER TABLE blocks ALTER COLUMN size TYPE BIGINT USING size::BIGINT; diff --git a/db/migrations/00039_rename_node_table.sql b/db/migrations/00039_rename_node_table.sql index 4e4c216f..061fda57 100644 --- a/db/migrations/00039_rename_node_table.sql +++ b/db/migrations/00039_rename_node_table.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00040_associate_receipts_with_blocks.sql b/db/migrations/00040_associate_receipts_with_blocks.sql index 1393af19..dea130fb 100644 --- a/db/migrations/00040_associate_receipts_with_blocks.sql +++ b/db/migrations/00040_associate_receipts_with_blocks.sql @@ -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; \ No newline at end of file diff --git a/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql b/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql index 382fec3c..5c48c03e 100644 --- a/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql +++ b/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql @@ -1,6 +1,4 @@ -- +goose Up -BEGIN; - ALTER TABLE blocks ADD COLUMN eth_node_fingerprint VARCHAR(128); @@ -12,8 +10,7 @@ UPDATE blocks ALTER TABLE blocks ALTER COLUMN eth_node_fingerprint SET NOT NULL; -COMMIT; -- +goose Down ALTER TABLE blocks - DROP COLUMN eth_node_fingerprint; \ No newline at end of file + DROP COLUMN eth_node_fingerprint; diff --git a/db/migrations/00042_create_token_supply_table.sql b/db/migrations/00042_create_token_supply_table.sql index f60bd064..5caf36fb 100644 --- a/db/migrations/00042_create_token_supply_table.sql +++ b/db/migrations/00042_create_token_supply_table.sql @@ -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; \ No newline at end of file +DROP TABLE token_supply; diff --git a/db/migrations/00043_create_headers_table.sql b/db/migrations/00043_create_headers_table.sql index 128e4380..22072fdd 100644 --- a/db/migrations/00043_create_headers_table.sql +++ b/db/migrations/00043_create_headers_table.sql @@ -12,5 +12,6 @@ CREATE TABLE public.headers ( ON DELETE CASCADE ); + -- +goose Down -DROP TABLE public.headers; \ No newline at end of file +DROP TABLE public.headers; diff --git a/db/migrations/00044_create_checked_headers_table.sql b/db/migrations/00044_create_checked_headers_table.sql index 23cf6d88..4a7069c3 100644 --- a/db/migrations/00044_create_checked_headers_table.sql +++ b/db/migrations/00044_create_checked_headers_table.sql @@ -6,4 +6,4 @@ CREATE TABLE public.checked_headers ( ); -- +goose Down -DROP TABLE public.checked_headers; \ No newline at end of file +DROP TABLE public.checked_headers; diff --git a/db/migrations/00045_create_maker_schema.sql b/db/migrations/00045_create_maker_schema.sql index b74e05ff..2880a0fe 100644 --- a/db/migrations/00045_create_maker_schema.sql +++ b/db/migrations/00045_create_maker_schema.sql @@ -2,6 +2,5 @@ CREATE SCHEMA maker; - -- +goose Down DROP SCHEMA maker; diff --git a/db/migrations/00046_create_flip_kick.sql b/db/migrations/00046_create_flip_kick.sql index 10b8c0f6..cb5b9d4d 100644 --- a/db/migrations/00046_create_flip_kick.sql +++ b/db/migrations/00046_create_flip_kick.sql @@ -18,8 +18,9 @@ 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; ALTER TABLE public.checked_headers - DROP COLUMN flip_kick_checked; \ No newline at end of file + DROP COLUMN flip_kick_checked; diff --git a/db/migrations/00047_create_frob.sql b/db/migrations/00047_create_frob.sql index 8c13f913..6e1f5e10 100644 --- a/db/migrations/00047_create_frob.sql +++ b/db/migrations/00047_create_frob.sql @@ -18,8 +18,9 @@ CREATE TABLE maker.frob ( ALTER TABLE public.checked_headers ADD COLUMN frob_checked BOOLEAN NOT NULL DEFAULT FALSE; + -- +goose Down DROP TABLE maker.frob; ALTER TABLE public.checked_headers - DROP COLUMN frob_checked; \ No newline at end of file + DROP COLUMN frob_checked; diff --git a/db/migrations/00048_create_price_feeds_table.sql b/db/migrations/00048_create_price_feeds_table.sql index cb325048..10ea48f2 100644 --- a/db/migrations/00048_create_price_feeds_table.sql +++ b/db/migrations/00048_create_price_feeds_table.sql @@ -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; \ No newline at end of file +DROP TABLE maker.price_feeds; diff --git a/db/migrations/00049_create_tend.sql b/db/migrations/00049_create_tend.sql index e4d07c2c..85df5505 100644 --- a/db/migrations/00049_create_tend.sql +++ b/db/migrations/00049_create_tend.sql @@ -21,4 +21,4 @@ ALTER TABLE public.checked_headers DROP TABLE maker.tend; ALTER TABLE public.checked_headers - DROP COLUMN tend_checked; \ No newline at end of file + DROP COLUMN tend_checked; diff --git a/db/migrations/00050_create_bite.sql b/db/migrations/00050_create_bite.sql index adc1dab1..cd01c1f1 100644 --- a/db/migrations/00050_create_bite.sql +++ b/db/migrations/00050_create_bite.sql @@ -18,8 +18,9 @@ CREATE TABLE maker.bite ( ALTER TABLE public.checked_headers ADD COLUMN bite_checked BOOLEAN NOT NULL DEFAULT FALSE; + -- +goose Down DROP TABLE maker.bite; ALTER TABLE public.checked_headers - DROP COLUMN bite_checked; \ No newline at end of file + DROP COLUMN bite_checked; diff --git a/db/migrations/00052_create_pit_file.sql b/db/migrations/00052_create_pit_file.sql index f7305c4e..712e8792 100644 --- a/db/migrations/00052_create_pit_file.sql +++ b/db/migrations/00052_create_pit_file.sql @@ -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; @@ -54,4 +55,4 @@ ALTER TABLE public.checked_headers DROP COLUMN pit_file_ilk_checked; ALTER TABLE public.checked_headers - DROP COLUMN pit_file_stability_fee_checked; \ No newline at end of file + DROP COLUMN pit_file_stability_fee_checked; diff --git a/db/migrations/00053_create_vat_init.sql b/db/migrations/00053_create_vat_init.sql index a3d59e61..41260840 100644 --- a/db/migrations/00053_create_vat_init.sql +++ b/db/migrations/00053_create_vat_init.sql @@ -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; diff --git a/db/migrations/00054_create_drip_file.sql b/db/migrations/00054_create_drip_file.sql index ecf1140d..21716834 100644 --- a/db/migrations/00054_create_drip_file.sql +++ b/db/migrations/00054_create_drip_file.sql @@ -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; @@ -54,4 +55,4 @@ ALTER TABLE public.checked_headers DROP COLUMN drip_file_repo_checked; ALTER TABLE public.checked_headers - DROP COLUMN drip_file_vow_checked; \ No newline at end of file + DROP COLUMN drip_file_vow_checked; diff --git a/db/migrations/00055_create_deal.sql b/db/migrations/00055_create_deal.sql index 42046693..4d8ec2c4 100644 --- a/db/migrations/00055_create_deal.sql +++ b/db/migrations/00055_create_deal.sql @@ -17,4 +17,4 @@ ALTER TABLE public.checked_headers DROP TABLE maker.deal; ALTER TABLE public.checked_headers - DROP COLUMN deal_checked; \ No newline at end of file + DROP COLUMN deal_checked; diff --git a/db/migrations/00056_add_price_feed_trigger.sql b/db/migrations/00056_add_price_feed_trigger.sql index a55d0bdf..b3bf0d2b 100644 --- a/db/migrations/00056_add_price_feed_trigger.sql +++ b/db/migrations/00056_add_price_feed_trigger.sql @@ -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 diff --git a/db/migrations/00057_create_drip_drip.sql b/db/migrations/00057_create_drip_drip.sql index baefddf0..ee951aa9 100644 --- a/db/migrations/00057_create_drip_drip.sql +++ b/db/migrations/00057_create_drip_drip.sql @@ -12,8 +12,9 @@ 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; ALTER TABLE public.checked_headers - DROP COLUMN drip_drip_checked; \ No newline at end of file + DROP COLUMN drip_drip_checked; diff --git a/db/migrations/00058_create_cat_file.sql b/db/migrations/00058_create_cat_file.sql index e25df996..6b8acd71 100644 --- a/db/migrations/00058_create_cat_file.sql +++ b/db/migrations/00058_create_cat_file.sql @@ -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; @@ -55,4 +56,4 @@ ALTER TABLE public.checked_headers DROP COLUMN cat_file_flip_checked; ALTER TABLE public.checked_headers - DROP COLUMN cat_file_pit_vow_checked; \ No newline at end of file + DROP COLUMN cat_file_pit_vow_checked; diff --git a/db/migrations/00059_create_flop_kick.sql b/db/migrations/00059_create_flop_kick.sql index a62e3d47..ff46654c 100644 --- a/db/migrations/00059_create_flop_kick.sql +++ b/db/migrations/00059_create_flop_kick.sql @@ -16,7 +16,8 @@ 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 - DROP COLUMN flop_kick_checked; \ No newline at end of file + DROP COLUMN flop_kick_checked; diff --git a/db/migrations/00060_create_vat_move.sql b/db/migrations/00060_create_vat_move.sql index 7aa31a24..4f156233 100644 --- a/db/migrations/00060_create_vat_move.sql +++ b/db/migrations/00060_create_vat_move.sql @@ -18,4 +18,4 @@ ALTER TABLE public.checked_headers -- +goose Down DROP TABLE maker.vat_move; ALTER TABLE public.checked_headers - DROP COLUMN vat_move_checked; \ No newline at end of file + DROP COLUMN vat_move_checked; diff --git a/db/migrations/00063_create_vat_toll.sql b/db/migrations/00063_create_vat_toll.sql index 1e29fbb1..bea6df99 100644 --- a/db/migrations/00063_create_vat_toll.sql +++ b/db/migrations/00063_create_vat_toll.sql @@ -14,7 +14,8 @@ 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 - DROP COLUMN vat_toll_checked; \ No newline at end of file + DROP COLUMN vat_toll_checked; diff --git a/db/migrations/00064_create_vat_tune.sql b/db/migrations/00064_create_vat_tune.sql index 07f625aa..bd8b5d4b 100644 --- a/db/migrations/00064_create_vat_tune.sql +++ b/db/migrations/00064_create_vat_tune.sql @@ -17,7 +17,8 @@ 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 - DROP COLUMN vat_tune_checked; \ No newline at end of file + DROP COLUMN vat_tune_checked; diff --git a/db/migrations/00065_create_vat_grab.sql b/db/migrations/00065_create_vat_grab.sql index 7fa5035d..e940708f 100644 --- a/db/migrations/00065_create_vat_grab.sql +++ b/db/migrations/00065_create_vat_grab.sql @@ -17,7 +17,8 @@ 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 - DROP COLUMN vat_grab_checked; \ No newline at end of file + DROP COLUMN vat_grab_checked; diff --git a/db/migrations/00067_create_vat_slip.sql b/db/migrations/00067_create_vat_slip.sql index a561eb69..5f4a457c 100644 --- a/db/migrations/00067_create_vat_slip.sql +++ b/db/migrations/00067_create_vat_slip.sql @@ -14,7 +14,8 @@ 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 - DROP COLUMN vat_slip_checked; \ No newline at end of file + DROP COLUMN vat_slip_checked; diff --git a/db/migrations/00068_create_vow_flog.sql b/db/migrations/00068_create_vow_flog.sql index c7e316bc..af429cca 100644 --- a/db/migrations/00068_create_vow_flog.sql +++ b/db/migrations/00068_create_vow_flog.sql @@ -12,7 +12,8 @@ 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 - DROP COLUMN vow_flog_checked; \ No newline at end of file + DROP COLUMN vow_flog_checked; diff --git a/db/migrations/00069_create_flap_kick.sql b/db/migrations/00069_create_flap_kick.sql index ab929cfd..71410fe4 100644 --- a/db/migrations/00069_create_flap_kick.sql +++ b/db/migrations/00069_create_flap_kick.sql @@ -16,7 +16,8 @@ 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 - DROP COLUMN flap_kick_checked; \ No newline at end of file + DROP COLUMN flap_kick_checked; diff --git a/db/migrations/00070_drop_pit_file_stability_fee.sql b/db/migrations/00070_drop_pit_file_stability_fee.sql index f5f20d8f..208be543 100644 --- a/db/migrations/00070_drop_pit_file_stability_fee.sql +++ b/db/migrations/00070_drop_pit_file_stability_fee.sql @@ -18,4 +18,4 @@ CREATE TABLE maker.pit_file_stability_fee ( ); ALTER TABLE public.checked_headers - ADD COLUMN pit_file_stability_fee_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + ADD COLUMN pit_file_stability_fee_checked BOOLEAN NOT NULL DEFAULT FALSE;