diff --git a/.travis.yml b/.travis.yml index 2995ce13..b00ed01f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ addons: go_import_path: github.com/vulcanize/vulcanizedb before_install: - # ginkgo golint dep migrate + # ginkgo golint dep goose - make installtools - bash ./scripts/install-postgres-10.sh - npm install -g ganache-cli @@ -23,6 +23,7 @@ before_install: before_script: - go get -u github.com/pressly/sup/cmd/sup - sudo -u postgres createdb vulcanize_private + - make version_migrations - make migrate NAME=vulcanize_private - bash ./pkg/transformers/start_test_chain.sh - cd postgraphile && yarn diff --git a/Makefile b/Makefile index 4746ce75..12ebbf20 100644 --- a/Makefile +++ b/Makefile @@ -2,31 +2,37 @@ BIN = $(GOPATH)/bin BASE = $(GOPATH)/src/$(PACKAGE) PKGS = go list ./... | grep -v "^vendor/" -#Tools +# Tools +## Dependency management DEP = $(BIN)/dep $(BIN)/dep: go get -u github.com/golang/dep/cmd/dep +## Testing library GINKGO = $(BIN)/ginkgo $(BIN)/ginkgo: go get -u github.com/onsi/ginkgo/ginkgo -MIGRATE = $(BIN)/migrate -$(BIN)/migrate: - go get -u -d github.com/mattes/migrate/cli github.com/lib/pq - go build -tags 'postgres' -o $(BIN)/migrate github.com/mattes/migrate/cli +## Migration tool +GOOSE = $(BIN)/goose +$(BIN)/goose: + go get -u -d github.com/pressly/goose/cmd/goose + go build -tags='no_mysql no_sqlite' -o $(BIN)/goose github.com/pressly/goose/cmd/goose +## Source linter LINT = $(BIN)/golint $(BIN)/golint: go get -u golang.org/x/lint/golint +## Combination linter METALINT = $(BIN)/gometalinter.v2 $(BIN)/gometalinter.v2: go get -u gopkg.in/alecthomas/gometalinter.v2 $(METALINT) --install + .PHONY: installtools -installtools: | $(LINT) $(MIGRATE) $(GINKGO) $(DEP) +installtools: | $(LINT) $(GOOSE) $(GINKGO) $(DEP) echo "Installing tools" .PHONY: metalint @@ -67,30 +73,74 @@ PORT = 5432 NAME = CONNECT_STRING=postgresql://$(HOST_NAME):$(PORT)/$(NAME)?sslmode=disable +# Parameter checks +## Check that DB variables are provided .PHONY: checkdbvars checkdbvars: - test -n "$(HOST_NAME)" # $$HOST_NAME + test -n "$(HOST_NAME)" # $$HOST_NAME test -n "$(PORT)" # $$PORT test -n "$(NAME)" # $$NAME @echo $(CONNECT_STRING) +## Check that the migration variable (id/timestamp) is provided +.PHONY: checkmigration +checkmigration: + test -n "$(MIGRATION)" # $$MIGRATION +# Check that the migration name is provided +.PHONY: checkmigname +checkmigname: + test -n "$(NAME)" # $$NAME + +# Migration operations +## Rollback the last migration .PHONY: rollback -rollback: $(MIGRATE) checkdbvars - $(MIGRATE) -database $(CONNECT_STRING) -path ./db/migrations down 1 +rollback: $(GOOSE) checkdbvars + cd db/migrations;\ + $(GOOSE) postgres "$(CONNECT_STRING)" down pg_dump -O -s $(CONNECT_STRING) > db/schema.sql + +## Rollbackt to a select migration (id/timestamp) +.PHONY: rollback_to +rollback_to: $(GOOSE) checkmigration checkdbvars + cd db/migrations;\ + $(GOOSE) postgres "$(CONNECT_STRING)" down-to "$(MIGRATION)" + +## Apply all migrations not already run .PHONY: migrate -migrate: $(MIGRATE) checkdbvars - $(MIGRATE) -database $(CONNECT_STRING) -path ./db/migrations up +migrate: $(GOOSE) checkdbvars + cd db/migrations;\ + $(GOOSE) postgres "$(CONNECT_STRING)" up pg_dump -O -s $(CONNECT_STRING) > db/schema.sql +## Create a new migration file +.PHONY: new_migration +new_migration: $(GOOSE) checkmigname + cd db/migrations;\ + $(GOOSE) create $(NAME) sql + +## Check which migrations are applied at the moment +.PHONY: migration_status +migration_status: $(GOOSE) checkdbvars + cd db/migrations;\ + $(GOOSE) postgres "$(CONNECT_STRING)" status + +# Convert timestamped migrations to versioned (to be run in CI); +# merge timestamped files to prevent conflict +.PHONY: version_migrations +version_migrations: + cd db/migrations; $(GOOSE) fix + +# Import a psql schema to the database .PHONY: import import: test -n "$(NAME)" # $$NAME psql $(NAME) < db/schema.sql -#Rinkeby docker environment + +# Docker actions +## Rinkeby docker environment RINKEBY_COMPOSE_FILE=dockerfiles/rinkeby/docker-compose.yml .PHONY: rinkeby_env_up diff --git a/README.md b/README.md index c46f9294..987235a3 100644 --- a/README.md +++ b/README.md @@ -46,18 +46,20 @@ Lastly, ensure that `GOPATH` is defined in your shell. If necessary, `GOPATH` ca ## Setting up the Database 1. Install Postgres 1. Create a superuser for yourself and make sure `psql --list` works without prompting for a password. -1. Execute `createdb vulcanize_public` -1. Execute `cd $GOPATH/src/github.com/vulcanize/vulcanizedb` -1. Run the migrations: `make migrate HOST_NAME=localhost NAME=vulcanize_public PORT=` +1. `createdb vulcanize_public` +1. `cd $GOPATH/src/github.com/vulcanize/vulcanizedb` +1. Run the migrations: `make migrate HOST_NAME=localhost NAME=vulcanize_public PORT=5432` + - To rollback a single step: `make rollback NAME=vulcanize_public` + - To rollback to a certain migration: `make rollback_to MIGRATION=n NAME=vulcanize_public` + - To see status of migrations: `make migration_status NAME=vulcanize_public` * See below for configuring additional environments -In some cases (such as recent Ubuntu systems), it may be necessary to overcome failures of password authentication from `localhost`. To allow access on Ubuntu, set localhost connections via hostname, ipv4, and ipv6 from `peer`/`md5` to `trust` in: `/etc/postgresql//pg_hba.conf` - -(It should be noted that trusted auth should only be enabled on systems without sensitive data in them: development and local test databases.) - -## Create a migration file (up and down) -1. ./script/create_migrate create_bite_table +## Create a migration file +1. `make new_migration NAME=add_columnA_to_table1` + - This will create a new timestamped migration file in `db/migrations` +1. Write the migration code in the created file, under the respective `goose` pragma + - Goose automatically runs each migration in a transaction; don't add `BEGIN` and `COMMIT` statements. ## Configuration - To use a local Ethereum node, copy `environments/public.toml.example` to diff --git a/Supfile b/Supfile index ba558f76..c224ae87 100644 --- a/Supfile +++ b/Supfile @@ -38,7 +38,8 @@ commands: run: > cd $VDB_PATH && make installtools && - /root/go_projects/bin/migrate -database postgresql://$VDB_PG_USER:$VDB_PG_PW@127.0.0.1:5432/vulcanize_public?sslmode=disable -path ./db/migrations up + cd db/migrations && + /root/go_projects/bin/goose postgres "postgresql://$(VDB_PG_USER):$(VDB_PG_PW)@127.0.0.1:5432/vulcanize_public?sslmode=disable" up buildPostgraphile: desc: build postgraphile app run: > diff --git a/db/migrations/00001_create_blocks_table.sql b/db/migrations/00001_create_blocks_table.sql new file mode 100644 index 00000000..f5fe43a6 --- /dev/null +++ b/db/migrations/00001_create_blocks_table.sql @@ -0,0 +1,9 @@ +-- +goose Up +CREATE TABLE public.blocks +( + block_number BIGINT +); + + +-- +goose Down +DROP TABLE public.blocks; diff --git a/db/migrations/1508965325_add_columns_to_blocks.up.sql b/db/migrations/00002_add_columns_to_blocks.sql similarity index 52% rename from db/migrations/1508965325_add_columns_to_blocks.up.sql rename to db/migrations/00002_add_columns_to_blocks.sql index 65c6262e..4d6626ab 100644 --- a/db/migrations/1508965325_add_columns_to_blocks.up.sql +++ b/db/migrations/00002_add_columns_to_blocks.sql @@ -1,4 +1,13 @@ +-- +goose Up ALTER TABLE blocks ADD COLUMN block_gaslimit DOUBLE PRECISION, ADD COLUMN block_gasused DOUBLE PRECISION, ADD COLUMN block_time DOUBLE PRECISION; + + +-- +goose Down +ALTER TABLE blocks + DROP COLUMN block_gaslimit, + DROP COLUMN block_gasused, + DROP COLUMN block_time; + diff --git a/db/migrations/1509119369_initial_transaction_table.up.sql b/db/migrations/00003_initial_transaction_table.sql similarity index 76% rename from db/migrations/1509119369_initial_transaction_table.up.sql rename to db/migrations/00003_initial_transaction_table.sql index d73b09fe..ba6b06a0 100644 --- a/db/migrations/1509119369_initial_transaction_table.up.sql +++ b/db/migrations/00003_initial_transaction_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE transactions ( id SERIAL PRIMARY KEY, @@ -7,4 +8,7 @@ CREATE TABLE transactions tx_gaslimit NUMERIC, tx_gasprice NUMERIC, tx_value NUMERIC -) \ No newline at end of file +); + +-- +goose Down +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 new file mode 100644 index 00000000..0f336243 --- /dev/null +++ b/db/migrations/00004_add_primary_key_to_blocks.sql @@ -0,0 +1,5 @@ +-- +goose Up +ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY; + +-- +goose Down +ALTER TABLE blocks DROP id; diff --git a/db/migrations/1509460207_add_block_id_to_transactions.up.sql b/db/migrations/00005_add_block_id_to_transactions.sql similarity index 52% rename from db/migrations/1509460207_add_block_id_to_transactions.up.sql rename to db/migrations/00005_add_block_id_to_transactions.sql index 0132dbc7..08e5002a 100644 --- a/db/migrations/1509460207_add_block_id_to_transactions.up.sql +++ b/db/migrations/00005_add_block_id_to_transactions.sql @@ -1,5 +1,11 @@ +-- +goose Up 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; diff --git a/db/migrations/00006_add_block_index.sql b/db/migrations/00006_add_block_index.sql new file mode 100644 index 00000000..e04815ee --- /dev/null +++ b/db/migrations/00006_add_block_index.sql @@ -0,0 +1,6 @@ +-- +goose Up +CREATE INDEX block_number_index ON blocks (block_number); + + +-- +goose Down +DROP INDEX block_number_index; diff --git a/db/migrations/00007_add_blocks_columns.sql b/db/migrations/00007_add_blocks_columns.sql new file mode 100644 index 00000000..f12c6a5d --- /dev/null +++ b/db/migrations/00007_add_blocks_columns.sql @@ -0,0 +1,18 @@ +-- +goose Up +ALTER TABLE blocks + ADD COLUMN block_difficulty BIGINT, + ADD COLUMN block_hash VARCHAR(66), + ADD COLUMN block_nonce VARCHAR(20), + ADD COLUMN block_parenthash VARCHAR(66), + ADD COLUMN block_size BIGINT, + ADD COLUMN uncle_hash VARCHAR(66); + + +-- +goose Down +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; diff --git a/db/migrations/1510257608_add_contracts_table.up.sql b/db/migrations/00008_add_contracts_table.sql similarity index 60% rename from db/migrations/1510257608_add_contracts_table.up.sql rename to db/migrations/00008_add_contracts_table.sql index c6dfe39a..d5016555 100644 --- a/db/migrations/1510257608_add_contracts_table.up.sql +++ b/db/migrations/00008_add_contracts_table.sql @@ -1,5 +1,9 @@ +-- +goose Up CREATE TABLE watched_contracts ( contract_id SERIAL PRIMARY KEY, contract_hash VARCHAR(66) -) \ No newline at end of file +); + +-- +goose Down +DROP TABLE watched_contracts; diff --git a/db/migrations/00009_add_from_to_transactions.sql b/db/migrations/00009_add_from_to_transactions.sql new file mode 100644 index 00000000..3311b7e4 --- /dev/null +++ b/db/migrations/00009_add_from_to_transactions.sql @@ -0,0 +1,8 @@ +-- +goose Up +ALTER TABLE transactions + ADD COLUMN tx_from VARCHAR(66); + + +-- +goose Down +ALTER TABLE transactions + 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 new file mode 100644 index 00000000..4520b9b7 --- /dev/null +++ b/db/migrations/00010_add_abi_to_watched_contracts.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE watched_contracts + ADD COLUMN contract_abi json; + +-- +goose Down +ALTER TABLE watched_contracts + DROP COLUMN contract_abi; diff --git a/db/migrations/1512504078_add_nodes_table.up.sql b/db/migrations/00011_add_nodes_table.sql similarity index 76% rename from db/migrations/1512504078_add_nodes_table.up.sql rename to db/migrations/00011_add_nodes_table.sql index 06fa91d9..46f1d51d 100644 --- a/db/migrations/1512504078_add_nodes_table.up.sql +++ b/db/migrations/00011_add_nodes_table.sql @@ -1,6 +1,10 @@ +-- +goose Up CREATE TABLE nodes ( id SERIAL PRIMARY KEY, genesis_block VARCHAR(66), network_id NUMERIC, CONSTRAINT node_uc UNIQUE (genesis_block, network_id) -); \ No newline at end of file +); + +-- +goose Down +DROP TABLE nodes; diff --git a/db/migrations/1513275969_add_cascade_delete_to_blocks.down.sql b/db/migrations/00012_add_node_fk_to_blocks.sql similarity index 54% rename from db/migrations/1513275969_add_cascade_delete_to_blocks.down.sql rename to db/migrations/00012_add_node_fk_to_blocks.sql index da798ece..6f658caa 100644 --- a/db/migrations/1513275969_add_cascade_delete_to_blocks.down.sql +++ b/db/migrations/00012_add_node_fk_to_blocks.sql @@ -1,11 +1,10 @@ -BEGIN; - -ALTER TABLE blocks - DROP CONSTRAINT node_fk; - +-- +goose Up ALTER TABLE blocks + ADD COLUMN node_id INTEGER NOT NULL, ADD CONSTRAINT node_fk FOREIGN KEY (node_id) REFERENCES nodes (id); -COMMIT; \ No newline at end of file +-- +goose Down +ALTER TABLE blocks + 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 new file mode 100644 index 00000000..4f252cce --- /dev/null +++ b/db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql @@ -0,0 +1,8 @@ +-- +goose Up +ALTER TABLE watched_contracts + ADD CONSTRAINT contract_hash_uc UNIQUE (contract_hash); + + +-- +goose Down +ALTER TABLE watched_contracts + DROP CONSTRAINT contract_hash_uc; diff --git a/db/migrations/1513029953_add_logs_table.up.sql b/db/migrations/00014_add_logs_table.sql similarity index 87% rename from db/migrations/1513029953_add_logs_table.up.sql rename to db/migrations/00014_add_logs_table.sql index a0cd805d..f85d35bd 100644 --- a/db/migrations/1513029953_add_logs_table.up.sql +++ b/db/migrations/00014_add_logs_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE logs ( id SERIAL PRIMARY KEY, block_number BIGINT, @@ -12,3 +13,7 @@ CREATE TABLE logs ( CONSTRAINT log_uc UNIQUE (block_number, index) ); + + +-- +goose Down +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 new file mode 100644 index 00000000..f10d52dd --- /dev/null +++ b/db/migrations/00015_add_cascade_delete_to_transactions.sql @@ -0,0 +1,19 @@ +-- +goose Up +ALTER TABLE transactions + DROP CONSTRAINT fk_test; + +ALTER TABLE transactions + ADD CONSTRAINT blocks_fk +FOREIGN KEY (block_id) +REFERENCES blocks (id) +ON DELETE CASCADE; + + +-- +goose Down +ALTER TABLE transactions + DROP CONSTRAINT blocks_fk; + +ALTER TABLE transactions + ADD CONSTRAINT fk_test +FOREIGN KEY (block_id) +REFERENCES blocks (id); diff --git a/db/migrations/00016_add_cascade_delete_to_blocks.sql b/db/migrations/00016_add_cascade_delete_to_blocks.sql new file mode 100644 index 00000000..5a0a7e5f --- /dev/null +++ b/db/migrations/00016_add_cascade_delete_to_blocks.sql @@ -0,0 +1,18 @@ +-- +goose Up +ALTER TABLE blocks + DROP CONSTRAINT node_fk; + +ALTER TABLE blocks + ADD CONSTRAINT node_fk +FOREIGN KEY (node_id) +REFERENCES nodes (id) +ON DELETE CASCADE; + +-- +goose Down +ALTER TABLE blocks + DROP CONSTRAINT node_fk; + +ALTER TABLE blocks + ADD CONSTRAINT node_fk +FOREIGN KEY (node_id) +REFERENCES nodes (id); diff --git a/db/migrations/00017_add_is_final_to_blocks.sql b/db/migrations/00017_add_is_final_to_blocks.sql new file mode 100644 index 00000000..bbb27d55 --- /dev/null +++ b/db/migrations/00017_add_is_final_to_blocks.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE blocks + ADD COLUMN is_final BOOLEAN; + +-- +goose Down +ALTER TABLE blocks + 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 new file mode 100644 index 00000000..e66e345f --- /dev/null +++ b/db/migrations/00018_add_unique_constraint_blocks_node.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE blocks + ADD CONSTRAINT node_id_block_number_uc UNIQUE (block_number, node_id); + +-- +goose Down +ALTER TABLE blocks + 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 new file mode 100644 index 00000000..318cc9be --- /dev/null +++ b/db/migrations/00019_add_block_id_index_on_transactions_table.sql @@ -0,0 +1,5 @@ +-- +goose Up +CREATE INDEX block_id_index ON transactions (block_id); + +-- +goose Down +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 new file mode 100644 index 00000000..bab71f97 --- /dev/null +++ b/db/migrations/00020_add_node_id_index_on_blocks_table.sql @@ -0,0 +1,5 @@ +-- +goose Up +CREATE INDEX node_id_index ON blocks (node_id); + +-- +goose Down +DROP INDEX node_id_index; diff --git a/db/migrations/00021_tx_to_index.sql b/db/migrations/00021_tx_to_index.sql new file mode 100644 index 00000000..fa50de5e --- /dev/null +++ b/db/migrations/00021_tx_to_index.sql @@ -0,0 +1,5 @@ +-- +goose Up +CREATE INDEX tx_to_index ON transactions(tx_to); + +-- +goose Down +DROP INDEX tx_to_index; diff --git a/db/migrations/00022_tx_from_index.sql b/db/migrations/00022_tx_from_index.sql new file mode 100644 index 00000000..6d052bae --- /dev/null +++ b/db/migrations/00022_tx_from_index.sql @@ -0,0 +1,5 @@ +-- +goose Up +CREATE INDEX tx_from_index ON transactions(tx_from); + +-- +goose Down +DROP INDEX tx_from_index; diff --git a/db/migrations/00023_add_miner.sql b/db/migrations/00023_add_miner.sql new file mode 100644 index 00000000..da1e120a --- /dev/null +++ b/db/migrations/00023_add_miner.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE blocks + ADD COLUMN block_miner VARCHAR(42); + +-- +goose Down +ALTER TABLE blocks + DROP COLUMN block_miner; diff --git a/db/migrations/00024_add_extra_data.sql b/db/migrations/00024_add_extra_data.sql new file mode 100644 index 00000000..66ff016b --- /dev/null +++ b/db/migrations/00024_add_extra_data.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE blocks + ADD COLUMN block_extra_data VARCHAR; + +-- +goose Down +ALTER TABLE blocks + DROP COLUMN block_extra_data; diff --git a/db/migrations/00025_add_block_reward_uncle_reward.sql b/db/migrations/00025_add_block_reward_uncle_reward.sql new file mode 100644 index 00000000..9932392f --- /dev/null +++ b/db/migrations/00025_add_block_reward_uncle_reward.sql @@ -0,0 +1,10 @@ +-- +goose Up +ALTER TABLE blocks + ADD COLUMN block_reward NUMERIC, + ADD COLUMN block_uncles_reward NUMERIC; + + +-- +goose Down +ALTER TABLE blocks + DROP COLUMN block_reward, + DROP COLUMN block_uncles_reward; diff --git a/db/migrations/00026_add_data_input_to_transactions.sql b/db/migrations/00026_add_data_input_to_transactions.sql new file mode 100644 index 00000000..454dfa16 --- /dev/null +++ b/db/migrations/00026_add_data_input_to_transactions.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE transactions + ADD COLUMN tx_input_data VARCHAR; + +-- +goose Down +ALTER TABLE transactions + DROP COLUMN tx_input_data; diff --git a/db/migrations/1514564898_create_receipts_table.up.sql b/db/migrations/00027_create_receipts_table.sql similarity index 89% rename from db/migrations/1514564898_create_receipts_table.up.sql rename to db/migrations/00027_create_receipts_table.sql index 2c4fd2f8..53ef4276 100644 --- a/db/migrations/1514564898_create_receipts_table.up.sql +++ b/db/migrations/00027_create_receipts_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE receipts ( id SERIAL PRIMARY KEY, @@ -14,3 +15,5 @@ CREATE TABLE receipts ); +-- +goose Down +DROP TABLE receipts; diff --git a/db/migrations/00028_add_transaction_id_index_to_receipts.sql b/db/migrations/00028_add_transaction_id_index_to_receipts.sql new file mode 100644 index 00000000..8f096532 --- /dev/null +++ b/db/migrations/00028_add_transaction_id_index_to_receipts.sql @@ -0,0 +1,5 @@ +-- +goose Up +CREATE INDEX transaction_id_index ON receipts (transaction_id); + +-- +goose Down +DROP INDEX transaction_id_index; diff --git a/db/migrations/00029_add_fields_to_node.sql b/db/migrations/00029_add_fields_to_node.sql new file mode 100644 index 00000000..b4dc223f --- /dev/null +++ b/db/migrations/00029_add_fields_to_node.sql @@ -0,0 +1,9 @@ +-- +goose Up +ALTER TABLE nodes + ADD COLUMN node_id VARCHAR(128), + ADD COLUMN client_name VARCHAR; + +-- +goose Down +ALTER TABLE nodes + DROP COLUMN node_id, + DROP COLUMN client_name; diff --git a/db/migrations/00030_update_node_index.sql b/db/migrations/00030_update_node_index.sql new file mode 100644 index 00000000..02ad2b2d --- /dev/null +++ b/db/migrations/00030_update_node_index.sql @@ -0,0 +1,14 @@ +-- +goose Up +ALTER TABLE nodes + DROP CONSTRAINT node_uc; + +ALTER TABLE nodes + ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id, node_id); + + +-- +goose Down +ALTER TABLE nodes + DROP CONSTRAINT node_uc; + +ALTER TABLE nodes + ADD CONSTRAINT node_uc UNIQUE (genesis_block, network_id); diff --git a/db/migrations/1516050071_add_log_fk_constraint.up.sql b/db/migrations/00031_add_log_fk_constraint.sql similarity index 51% rename from db/migrations/1516050071_add_log_fk_constraint.up.sql rename to db/migrations/00031_add_log_fk_constraint.sql index 60733b71..a31701b1 100644 --- a/db/migrations/1516050071_add_log_fk_constraint.up.sql +++ b/db/migrations/00031_add_log_fk_constraint.sql @@ -1,4 +1,4 @@ -BEGIN; +-- +goose Up ALTER TABLE logs DROP CONSTRAINT log_uc; @@ -11,4 +11,13 @@ FOREIGN KEY (receipt_id) REFERENCES receipts (id) ON DELETE CASCADE; -COMMIT; \ No newline at end of file + +-- +goose Down +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); diff --git a/db/migrations/1516648743_add_log_filters.up.sql b/db/migrations/00032_add_log_filters.sql similarity index 86% rename from db/migrations/1516648743_add_log_filters.up.sql rename to db/migrations/00032_add_log_filters.sql index 100a5718..0367f5e5 100644 --- a/db/migrations/1516648743_add_log_filters.up.sql +++ b/db/migrations/00032_add_log_filters.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE log_filters ( id SERIAL, name VARCHAR NOT NULL CHECK (name <> ''), @@ -9,4 +10,7 @@ CREATE TABLE log_filters ( topic2 VARCHAR(66), topic3 VARCHAR(66), CONSTRAINT name_uc UNIQUE (name) -); \ No newline at end of file +); + +-- +goose Down +DROP TABLE log_filters; diff --git a/db/migrations/1516653373_add_watched_event_logs.up.sql b/db/migrations/00033_add_watched_event_logs.sql similarity index 90% rename from db/migrations/1516653373_add_watched_event_logs.up.sql rename to db/migrations/00033_add_watched_event_logs.sql index 3bba916f..ae17ee08 100644 --- a/db/migrations/1516653373_add_watched_event_logs.up.sql +++ b/db/migrations/00033_add_watched_event_logs.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE VIEW block_stats AS SELECT max(block_number) AS max_block, @@ -26,4 +27,8 @@ CREATE VIEW watched_event_logs AS WHERE (log_filters.topic0 = logs.topic0 OR log_filters.topic0 ISNULL) AND (log_filters.topic1 = logs.topic1 OR log_filters.topic1 ISNULL) AND (log_filters.topic2 = logs.topic2 OR log_filters.topic2 ISNULL) - AND (log_filters.topic3 = logs.topic3 OR log_filters.topic3 ISNULL); \ No newline at end of file + AND (log_filters.topic3 = logs.topic3 OR log_filters.topic3 ISNULL); + +-- +goose Down +DROP VIEW watched_event_logs; +DROP VIEW block_stats; diff --git a/db/migrations/00034_update_gas_limit_gas_used.sql b/db/migrations/00034_update_gas_limit_gas_used.sql new file mode 100644 index 00000000..276de18e --- /dev/null +++ b/db/migrations/00034_update_gas_limit_gas_used.sql @@ -0,0 +1,32 @@ +-- +goose Up +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; + + +-- +goose Down +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; diff --git a/db/migrations/00035_rename_block_columns.sql b/db/migrations/00035_rename_block_columns.sql new file mode 100644 index 00000000..d093ddb4 --- /dev/null +++ b/db/migrations/00035_rename_block_columns.sql @@ -0,0 +1,80 @@ +-- +goose Up +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; + + +-- +goose Down +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; diff --git a/db/migrations/00036_update_tx_table_names.sql b/db/migrations/00036_update_tx_table_names.sql new file mode 100644 index 00000000..41848828 --- /dev/null +++ b/db/migrations/00036_update_tx_table_names.sql @@ -0,0 +1,38 @@ +-- +goose Up +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; + + +-- +goose Down +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; diff --git a/db/migrations/00037_update_log_filters_to_block_constraint.sql b/db/migrations/00037_update_log_filters_to_block_constraint.sql new file mode 100644 index 00000000..512a44db --- /dev/null +++ b/db/migrations/00037_update_log_filters_to_block_constraint.sql @@ -0,0 +1,14 @@ +-- +goose Up +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); + + +-- +goose Down +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); diff --git a/db/migrations/00038_update_eth18_types.sql b/db/migrations/00038_update_eth18_types.sql new file mode 100644 index 00000000..3389d1aa --- /dev/null +++ b/db/migrations/00038_update_eth18_types.sql @@ -0,0 +1,8 @@ +-- +goose Up +ALTER TABLE blocks + ALTER COLUMN size TYPE VARCHAR USING size::VARCHAR; + + +-- +goose Down +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 new file mode 100644 index 00000000..061fda57 --- /dev/null +++ b/db/migrations/00039_rename_node_table.sql @@ -0,0 +1,43 @@ +-- +goose Up +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; + + +-- +goose Down +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; diff --git a/db/migrations/1525122581_associate_receipts_with_blocks.down.sql b/db/migrations/00040_associate_receipts_with_blocks.sql similarity index 52% rename from db/migrations/1525122581_associate_receipts_with_blocks.down.sql rename to db/migrations/00040_associate_receipts_with_blocks.sql index e6ce2266..889772ff 100644 --- a/db/migrations/1525122581_associate_receipts_with_blocks.down.sql +++ b/db/migrations/00040_associate_receipts_with_blocks.sql @@ -1,5 +1,26 @@ -BEGIN; +-- +goose Up +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; + + +-- +goose Down ALTER TABLE receipts ADD COLUMN transaction_id INT; @@ -21,5 +42,3 @@ ON DELETE CASCADE; ALTER TABLE receipts DROP COLUMN block_id; - -COMMIT; diff --git a/db/migrations/1525464568_add_eth_node_fingerprint_to_blocks.up.sql b/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql similarity index 76% rename from db/migrations/1525464568_add_eth_node_fingerprint_to_blocks.up.sql rename to db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql index 947db2c7..5c48c03e 100644 --- a/db/migrations/1525464568_add_eth_node_fingerprint_to_blocks.up.sql +++ b/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql @@ -1,5 +1,4 @@ -BEGIN; - +-- +goose Up ALTER TABLE blocks ADD COLUMN eth_node_fingerprint VARCHAR(128); @@ -11,4 +10,7 @@ UPDATE blocks ALTER TABLE blocks ALTER COLUMN eth_node_fingerprint SET NOT NULL; -COMMIT; \ No newline at end of file + +-- +goose Down +ALTER TABLE blocks + DROP COLUMN eth_node_fingerprint; diff --git a/db/migrations/1528317902_create_token_supply_table.up.sql b/db/migrations/00042_create_token_supply_table.sql similarity index 81% rename from db/migrations/1528317902_create_token_supply_table.up.sql rename to db/migrations/00042_create_token_supply_table.sql index 69289885..5caf36fb 100644 --- a/db/migrations/1528317902_create_token_supply_table.up.sql +++ b/db/migrations/00042_create_token_supply_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE token_supply ( id SERIAL, block_id INTEGER NOT NULL, @@ -6,4 +7,8 @@ CREATE TABLE token_supply ( CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES blocks (id) ON DELETE CASCADE -) +); + + +-- +goose Down +DROP TABLE token_supply; diff --git a/db/migrations/1531758090_create_headers_table.up.sql b/db/migrations/00043_create_headers_table.sql similarity index 86% rename from db/migrations/1531758090_create_headers_table.up.sql rename to db/migrations/00043_create_headers_table.sql index 47fafda2..22072fdd 100644 --- a/db/migrations/1531758090_create_headers_table.up.sql +++ b/db/migrations/00043_create_headers_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE public.headers ( id SERIAL PRIMARY KEY, hash VARCHAR(66), @@ -9,4 +10,8 @@ CREATE TABLE public.headers ( CONSTRAINT eth_nodes_fk FOREIGN KEY (eth_node_id) REFERENCES eth_nodes (id) ON DELETE CASCADE -); \ No newline at end of file +); + + +-- +goose Down +DROP TABLE public.headers; diff --git a/db/migrations/1532468317_create_checked_headers_table.up.sql b/db/migrations/00044_create_checked_headers_table.sql similarity index 76% rename from db/migrations/1532468317_create_checked_headers_table.up.sql rename to db/migrations/00044_create_checked_headers_table.sql index 6a39e0dd..4a7069c3 100644 --- a/db/migrations/1532468317_create_checked_headers_table.up.sql +++ b/db/migrations/00044_create_checked_headers_table.sql @@ -1,5 +1,9 @@ +-- +goose Up CREATE TABLE public.checked_headers ( id SERIAL PRIMARY KEY, header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE, price_feeds_checked BOOLEAN NOT NULL DEFAULT FALSE -); \ No newline at end of file +); + +-- +goose Down +DROP TABLE public.checked_headers; diff --git a/db/migrations/00045_create_maker_schema.sql b/db/migrations/00045_create_maker_schema.sql new file mode 100644 index 00000000..2880a0fe --- /dev/null +++ b/db/migrations/00045_create_maker_schema.sql @@ -0,0 +1,6 @@ +-- +goose Up +CREATE SCHEMA maker; + + +-- +goose Down +DROP SCHEMA maker; diff --git a/db/migrations/1532468319_create_flip_kick.up.sql b/db/migrations/00046_create_flip_kick.sql similarity index 72% rename from db/migrations/1532468319_create_flip_kick.up.sql rename to db/migrations/00046_create_flip_kick.sql index 0689bf67..cb5b9d4d 100644 --- a/db/migrations/1532468319_create_flip_kick.up.sql +++ b/db/migrations/00046_create_flip_kick.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.flip_kick ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -15,4 +16,11 @@ CREATE TABLE maker.flip_kick ( ); ALTER TABLE public.checked_headers - ADD COLUMN flip_kick_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1533844125_create_frob.up.sql b/db/migrations/00047_create_frob.sql similarity index 70% rename from db/migrations/1533844125_create_frob.up.sql rename to db/migrations/00047_create_frob.sql index 2ef436b1..6e1f5e10 100644 --- a/db/migrations/1533844125_create_frob.up.sql +++ b/db/migrations/00047_create_frob.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.frob ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -15,4 +16,11 @@ CREATE TABLE maker.frob ( ); ALTER TABLE public.checked_headers - ADD COLUMN frob_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + ADD COLUMN frob_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.frob; + +ALTER TABLE public.checked_headers + DROP COLUMN frob_checked; diff --git a/db/migrations/1534275305_create_price_feeds_table.up.sql b/db/migrations/00048_create_price_feeds_table.sql similarity index 87% rename from db/migrations/1534275305_create_price_feeds_table.up.sql rename to db/migrations/00048_create_price_feeds_table.sql index 9ea8c12a..10ea48f2 100644 --- a/db/migrations/1534275305_create_price_feeds_table.up.sql +++ b/db/migrations/00048_create_price_feeds_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.price_feeds ( id SERIAL PRIMARY KEY, block_number BIGINT NOT NULL, @@ -8,4 +9,8 @@ CREATE TABLE maker.price_feeds ( tx_idx INTEGER NOT NULL, raw_log JSONB, UNIQUE (header_id, medianizer_address, tx_idx, log_idx) -); \ No newline at end of file +); + + +-- +goose Down +DROP TABLE maker.price_feeds; diff --git a/db/migrations/1534295712_create_tend.up.sql b/db/migrations/00049_create_tend.sql similarity index 81% rename from db/migrations/1534295712_create_tend.up.sql rename to db/migrations/00049_create_tend.sql index 8c6a162f..85df5505 100644 --- a/db/migrations/1534295712_create_tend.up.sql +++ b/db/migrations/00049_create_tend.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.tend ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -14,3 +15,10 @@ CREATE TABLE maker.tend ( ALTER TABLE public.checked_headers ADD COLUMN tend_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.tend; + +ALTER TABLE public.checked_headers + DROP COLUMN tend_checked; diff --git a/db/migrations/1534295713_create_bite.up.sql b/db/migrations/00050_create_bite.sql similarity index 70% rename from db/migrations/1534295713_create_bite.up.sql rename to db/migrations/00050_create_bite.sql index 4de235e5..cd01c1f1 100644 --- a/db/migrations/1534295713_create_bite.up.sql +++ b/db/migrations/00050_create_bite.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.bite ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -15,4 +16,11 @@ CREATE TABLE maker.bite ( ); ALTER TABLE public.checked_headers - ADD COLUMN bite_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + ADD COLUMN bite_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.bite; + +ALTER TABLE public.checked_headers + DROP COLUMN bite_checked; diff --git a/db/migrations/1534799167_create_dent.up.sql b/db/migrations/00051_create_dent.sql similarity index 81% rename from db/migrations/1534799167_create_dent.up.sql rename to db/migrations/00051_create_dent.sql index 3e408aab..a0179aa4 100644 --- a/db/migrations/1534799167_create_dent.up.sql +++ b/db/migrations/00051_create_dent.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.dent ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -14,3 +15,10 @@ CREATE TABLE maker.dent ( ALTER TABLE public.checked_headers ADD COLUMN dent_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.dent; + +ALTER TABLE public.checked_headers + DROP COLUMN dent_checked; \ No newline at end of file diff --git a/db/migrations/1535667935_create_pit_file.up.sql b/db/migrations/00052_create_pit_file.sql similarity index 76% rename from db/migrations/1535667935_create_pit_file.up.sql rename to db/migrations/00052_create_pit_file.sql index 00d3695e..712e8792 100644 --- a/db/migrations/1535667935_create_pit_file.up.sql +++ b/db/migrations/00052_create_pit_file.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.pit_file_ilk ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -39,4 +40,19 @@ ALTER TABLE public.checked_headers ADD COLUMN pit_file_ilk_checked BOOLEAN NOT NULL DEFAULT FALSE; 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; + + +-- +goose Down +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; diff --git a/db/migrations/1536267596_create_vat_init.up.sql b/db/migrations/00053_create_vat_init.sql similarity index 64% rename from db/migrations/1536267596_create_vat_init.up.sql rename to db/migrations/00053_create_vat_init.sql index 38c5402d..41260840 100644 --- a/db/migrations/1536267596_create_vat_init.up.sql +++ b/db/migrations/00053_create_vat_init.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_init ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -9,4 +10,11 @@ CREATE TABLE maker.vat_init ( ); ALTER TABLE public.checked_headers - ADD COLUMN vat_init_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + ADD COLUMN vat_init_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.vat_init; + +ALTER TABLE public.checked_headers + DROP COLUMN vat_init_checked; \ No newline at end of file diff --git a/db/migrations/1536603967_create_drip_file.up.sql b/db/migrations/00054_create_drip_file.sql similarity index 77% rename from db/migrations/1536603967_create_drip_file.up.sql rename to db/migrations/00054_create_drip_file.sql index 0c657f0f..21716834 100644 --- a/db/migrations/1536603967_create_drip_file.up.sql +++ b/db/migrations/00054_create_drip_file.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.drip_file_ilk ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -39,4 +40,19 @@ ALTER TABLE public.checked_headers ADD COLUMN drip_file_repo_checked BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE public.checked_headers - ADD COLUMN drip_file_vow_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; +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; diff --git a/db/migrations/1536615440_create_deal.up.sql b/db/migrations/00055_create_deal.sql similarity index 69% rename from db/migrations/1536615440_create_deal.up.sql rename to db/migrations/00055_create_deal.sql index ce5db6c6..4d8ec2c4 100644 --- a/db/migrations/1536615440_create_deal.up.sql +++ b/db/migrations/00055_create_deal.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.deal ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -10,4 +11,10 @@ CREATE TABLE maker.deal ( ); ALTER TABLE public.checked_headers - ADD COLUMN deal_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + ADD COLUMN deal_checked BOOLEAN NOT NULL DEFAULT FALSE; + +-- +goose Down +DROP TABLE maker.deal; + +ALTER TABLE public.checked_headers + DROP COLUMN deal_checked; diff --git a/db/migrations/1536702963_add_price_feed_trigger.up.sql b/db/migrations/00056_add_price_feed_trigger.sql similarity index 74% rename from db/migrations/1536702963_add_price_feed_trigger.up.sql rename to db/migrations/00056_add_price_feed_trigger.sql index 1127c8e2..b3bf0d2b 100644 --- a/db/migrations/1536702963_add_price_feed_trigger.up.sql +++ b/db/migrations/00056_add_price_feed_trigger.sql @@ -1,3 +1,5 @@ +-- +goose Up +-- +goose StatementBegin CREATE OR REPLACE FUNCTION notify_pricefeed() RETURNS trigger AS $$ BEGIN PERFORM pg_notify( @@ -7,8 +9,13 @@ BEGIN RETURN NEW; END; $$ LANGUAGE plpgsql; +-- +goose StatementEnd CREATE TRIGGER notify_pricefeeds AFTER INSERT ON maker.price_feeds FOR EACH ROW EXECUTE PROCEDURE notify_pricefeed(); + + +-- +goose Down +DROP TRIGGER notify_pricefeeds ON maker.price_feeds; diff --git a/db/migrations/1536710319_create_drip_drip.up.sql b/db/migrations/00057_create_drip_drip.sql similarity index 63% rename from db/migrations/1536710319_create_drip_drip.up.sql rename to db/migrations/00057_create_drip_drip.sql index b9ff8bb4..ee951aa9 100644 --- a/db/migrations/1536710319_create_drip_drip.up.sql +++ b/db/migrations/00057_create_drip_drip.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.drip_drip ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -9,4 +10,11 @@ CREATE TABLE maker.drip_drip ( ); ALTER TABLE public.checked_headers - ADD COLUMN drip_drip_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1536765047_create_cat_file.up.sql b/db/migrations/00058_create_cat_file.sql similarity index 78% rename from db/migrations/1536765047_create_cat_file.up.sql rename to db/migrations/00058_create_cat_file.sql index 100c14e6..6b8acd71 100644 --- a/db/migrations/1536765047_create_cat_file.up.sql +++ b/db/migrations/00058_create_cat_file.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.cat_file_chop_lump ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -40,4 +41,19 @@ ALTER TABLE public.checked_headers ADD COLUMN cat_file_flip_checked BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE public.checked_headers - ADD COLUMN cat_file_pit_vow_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; +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; diff --git a/db/migrations/1536942529_create_flop_kick.up.sql b/db/migrations/00059_create_flop_kick.sql similarity index 71% rename from db/migrations/1536942529_create_flop_kick.up.sql rename to db/migrations/00059_create_flop_kick.sql index da3bc353..ff46654c 100644 --- a/db/migrations/1536942529_create_flop_kick.up.sql +++ b/db/migrations/00059_create_flop_kick.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.flop_kick ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -13,4 +14,10 @@ CREATE TABLE maker.flop_kick ( ); ALTER TABLE public.checked_headers - ADD COLUMN flop_kick_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1538396815_create_vat_move.up.sql b/db/migrations/00060_create_vat_move.sql similarity index 79% rename from db/migrations/1538396815_create_vat_move.up.sql rename to db/migrations/00060_create_vat_move.sql index 8c355133..4f156233 100644 --- a/db/migrations/1538396815_create_vat_move.up.sql +++ b/db/migrations/00060_create_vat_move.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_move ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -12,3 +13,9 @@ CREATE TABLE maker.vat_move ( ALTER TABLE public.checked_headers ADD COLUMN vat_move_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.vat_move; +ALTER TABLE public.checked_headers + DROP COLUMN vat_move_checked; diff --git a/db/migrations/1538510582_create_vat_fold_table.up.sql b/db/migrations/00061_create_vat_fold_table.sql similarity index 76% rename from db/migrations/1538510582_create_vat_fold_table.up.sql rename to db/migrations/00061_create_vat_fold_table.sql index 4076ec0d..33c54fae 100644 --- a/db/migrations/1538510582_create_vat_fold_table.up.sql +++ b/db/migrations/00061_create_vat_fold_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_fold ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -12,3 +13,9 @@ CREATE TABLE maker.vat_fold ( ALTER TABLE public.checked_headers ADD COLUMN vat_fold_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.vat_fold; +ALTER TABLE public.checked_headers + DROP COLUMN vat_fold_checked; diff --git a/db/migrations/1538671228_create_vat_heal.up.sql b/db/migrations/00062_create_vat_heal.sql similarity index 77% rename from db/migrations/1538671228_create_vat_heal.up.sql rename to db/migrations/00062_create_vat_heal.sql index fa1fc5a5..a5524b4f 100644 --- a/db/migrations/1538671228_create_vat_heal.up.sql +++ b/db/migrations/00062_create_vat_heal.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_heal ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -12,3 +13,9 @@ CREATE TABLE maker.vat_heal ( ALTER TABLE public.checked_headers ADD COLUMN vat_heal_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.vat_heal; +ALTER TABLE public.checked_headers + DROP COLUMN vat_heal_checked; diff --git a/db/migrations/1538679495_create_vat_toll.up.sql b/db/migrations/00063_create_vat_toll.sql similarity index 67% rename from db/migrations/1538679495_create_vat_toll.up.sql rename to db/migrations/00063_create_vat_toll.sql index 9b2f3673..bea6df99 100644 --- a/db/migrations/1538679495_create_vat_toll.up.sql +++ b/db/migrations/00063_create_vat_toll.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_toll ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -11,4 +12,10 @@ CREATE TABLE maker.vat_toll ( ); ALTER TABLE public.checked_headers - ADD COLUMN vat_toll_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1538689084_create_vat_tune.up.sql b/db/migrations/00064_create_vat_tune.sql similarity index 70% rename from db/migrations/1538689084_create_vat_tune.up.sql rename to db/migrations/00064_create_vat_tune.sql index 3cabdc73..bd8b5d4b 100644 --- a/db/migrations/1538689084_create_vat_tune.up.sql +++ b/db/migrations/00064_create_vat_tune.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_tune ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -14,4 +15,10 @@ CREATE TABLE maker.vat_tune ( ); ALTER TABLE public.checked_headers - ADD COLUMN vat_tune_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1539033620_create_vat_grab.up.sql b/db/migrations/00065_create_vat_grab.sql similarity index 70% rename from db/migrations/1539033620_create_vat_grab.up.sql rename to db/migrations/00065_create_vat_grab.sql index 85aa8d50..e940708f 100644 --- a/db/migrations/1539033620_create_vat_grab.up.sql +++ b/db/migrations/00065_create_vat_grab.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_grab ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -14,4 +15,10 @@ CREATE TABLE maker.vat_grab ( ); ALTER TABLE public.checked_headers - ADD COLUMN vat_grab_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1539276289_create_vat_flux_table.up.sql b/db/migrations/00066_create_vat_flux_table.sql similarity index 78% rename from db/migrations/1539276289_create_vat_flux_table.up.sql rename to db/migrations/00066_create_vat_flux_table.sql index ebc3182e..f0e659f2 100644 --- a/db/migrations/1539276289_create_vat_flux_table.up.sql +++ b/db/migrations/00066_create_vat_flux_table.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_flux ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -13,3 +14,9 @@ CREATE TABLE maker.vat_flux ( ALTER TABLE public.checked_headers ADD COLUMN vat_flux_checked BOOLEAN NOT NULL DEFAULT FALSE; + + +-- +goose Down +DROP TABLE maker.vat_flux; +ALTER TABLE public.checked_headers + DROP COLUMN vat_flux_checked; diff --git a/db/migrations/1539638109_create_vat_slip.up.sql b/db/migrations/00067_create_vat_slip.sql similarity index 67% rename from db/migrations/1539638109_create_vat_slip.up.sql rename to db/migrations/00067_create_vat_slip.sql index cf5e270b..5f4a457c 100644 --- a/db/migrations/1539638109_create_vat_slip.up.sql +++ b/db/migrations/00067_create_vat_slip.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vat_slip ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -11,4 +12,10 @@ CREATE TABLE maker.vat_slip ( ); ALTER TABLE public.checked_headers - ADD COLUMN vat_slip_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1540297136_create_vow_flog.up.sql b/db/migrations/00068_create_vow_flog.sql similarity index 64% rename from db/migrations/1540297136_create_vow_flog.up.sql rename to db/migrations/00068_create_vow_flog.sql index 816de60c..af429cca 100644 --- a/db/migrations/1540297136_create_vow_flog.up.sql +++ b/db/migrations/00068_create_vow_flog.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.vow_flog ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -9,4 +10,10 @@ CREATE TABLE maker.vow_flog ( ); ALTER TABLE public.checked_headers - ADD COLUMN vow_flog_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1541525500_create_flap_kick.up.sql b/db/migrations/00069_create_flap_kick.sql similarity index 71% rename from db/migrations/1541525500_create_flap_kick.up.sql rename to db/migrations/00069_create_flap_kick.sql index aabc8ec3..71410fe4 100644 --- a/db/migrations/1541525500_create_flap_kick.up.sql +++ b/db/migrations/00069_create_flap_kick.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE maker.flap_kick ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -13,4 +14,10 @@ CREATE TABLE maker.flap_kick ( ); ALTER TABLE public.checked_headers - ADD COLUMN flap_kick_checked BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file + 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; diff --git a/db/migrations/1542222088_drop_pit_file_stability_fee.down.sql b/db/migrations/00070_drop_pit_file_stability_fee.sql similarity index 70% rename from db/migrations/1542222088_drop_pit_file_stability_fee.down.sql rename to db/migrations/00070_drop_pit_file_stability_fee.sql index e8590699..208be543 100644 --- a/db/migrations/1542222088_drop_pit_file_stability_fee.down.sql +++ b/db/migrations/00070_drop_pit_file_stability_fee.sql @@ -1,3 +1,11 @@ +-- +goose Up +DROP TABLE maker.pit_file_stability_fee; + +ALTER TABLE public.checked_headers + DROP COLUMN pit_file_stability_fee_checked; + + +-- +goose Down CREATE TABLE maker.pit_file_stability_fee ( id SERIAL PRIMARY KEY, header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, @@ -10,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; diff --git a/db/migrations/1508943247_create_blocks_table.down.sql b/db/migrations/1508943247_create_blocks_table.down.sql deleted file mode 100644 index 8ea49617..00000000 --- a/db/migrations/1508943247_create_blocks_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE public.blocks diff --git a/db/migrations/1508943247_create_blocks_table.up.sql b/db/migrations/1508943247_create_blocks_table.up.sql deleted file mode 100644 index 398bc2c7..00000000 --- a/db/migrations/1508943247_create_blocks_table.up.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE public.blocks -( - block_number BIGINT -) diff --git a/db/migrations/1508965325_add_columns_to_blocks.down.sql b/db/migrations/1508965325_add_columns_to_blocks.down.sql deleted file mode 100644 index 7624ef13..00000000 --- a/db/migrations/1508965325_add_columns_to_blocks.down.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN block_gaslimit, - DROP COLUMN block_gasused, - DROP COLUMN block_time; - diff --git a/db/migrations/1509119369_initial_transaction_table.down.sql b/db/migrations/1509119369_initial_transaction_table.down.sql deleted file mode 100644 index bd4e7b76..00000000 --- a/db/migrations/1509119369_initial_transaction_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE transactions \ No newline at end of file diff --git a/db/migrations/1509391861_add_primary_key_to_blocks.down.sql b/db/migrations/1509391861_add_primary_key_to_blocks.down.sql deleted file mode 100644 index 8840f9d2..00000000 --- a/db/migrations/1509391861_add_primary_key_to_blocks.down.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE blocks DROP id \ No newline at end of file diff --git a/db/migrations/1509391861_add_primary_key_to_blocks.up.sql b/db/migrations/1509391861_add_primary_key_to_blocks.up.sql deleted file mode 100644 index e2b68955..00000000 --- a/db/migrations/1509391861_add_primary_key_to_blocks.up.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY \ No newline at end of file diff --git a/db/migrations/1509460207_add_block_id_to_transactions.down.sql b/db/migrations/1509460207_add_block_id_to_transactions.down.sql deleted file mode 100644 index ef380fe4..00000000 --- a/db/migrations/1509460207_add_block_id_to_transactions.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE transactions - DROP COLUMN block_id \ No newline at end of file diff --git a/db/migrations/1509484288_add_block_index.down.sql b/db/migrations/1509484288_add_block_index.down.sql deleted file mode 100644 index 9a1d42fb..00000000 --- a/db/migrations/1509484288_add_block_index.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP INDEX block_number_index; \ No newline at end of file diff --git a/db/migrations/1509484288_add_block_index.up.sql b/db/migrations/1509484288_add_block_index.up.sql deleted file mode 100644 index a4710b9c..00000000 --- a/db/migrations/1509484288_add_block_index.up.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX block_number_index ON blocks (block_number); diff --git a/db/migrations/1509633481_add_blocks_columns.down.sql b/db/migrations/1509633481_add_blocks_columns.down.sql deleted file mode 100644 index 74f2f396..00000000 --- a/db/migrations/1509633481_add_blocks_columns.down.sql +++ /dev/null @@ -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 \ No newline at end of file diff --git a/db/migrations/1509633481_add_blocks_columns.up.sql b/db/migrations/1509633481_add_blocks_columns.up.sql deleted file mode 100644 index d373b00f..00000000 --- a/db/migrations/1509633481_add_blocks_columns.up.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE blocks - ADD COLUMN block_difficulty BIGINT, - ADD COLUMN block_hash VARCHAR(66), - ADD COLUMN block_nonce VARCHAR(20), - ADD COLUMN block_parenthash VARCHAR(66), - ADD COLUMN block_size BIGINT, - ADD COLUMN uncle_hash VARCHAR(66) diff --git a/db/migrations/1510257608_add_contracts_table.down.sql b/db/migrations/1510257608_add_contracts_table.down.sql deleted file mode 100644 index 3762ad16..00000000 --- a/db/migrations/1510257608_add_contracts_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE watched_contracts \ No newline at end of file diff --git a/db/migrations/1510262915_add_from_to_transactions.down.sql b/db/migrations/1510262915_add_from_to_transactions.down.sql deleted file mode 100644 index 1f323136..00000000 --- a/db/migrations/1510262915_add_from_to_transactions.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE transactions - DROP COLUMN tx_from diff --git a/db/migrations/1510262915_add_from_to_transactions.up.sql b/db/migrations/1510262915_add_from_to_transactions.up.sql deleted file mode 100644 index 2222e866..00000000 --- a/db/migrations/1510262915_add_from_to_transactions.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE transactions - ADD COLUMN tx_from VARCHAR(66) diff --git a/db/migrations/1512417153_add_abi_to_watched_contracts.down.sql b/db/migrations/1512417153_add_abi_to_watched_contracts.down.sql deleted file mode 100644 index e22ac41f..00000000 --- a/db/migrations/1512417153_add_abi_to_watched_contracts.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE watched_contracts - DROP COLUMN contract_abi; \ No newline at end of file diff --git a/db/migrations/1512417153_add_abi_to_watched_contracts.up.sql b/db/migrations/1512417153_add_abi_to_watched_contracts.up.sql deleted file mode 100644 index 4212ee9f..00000000 --- a/db/migrations/1512417153_add_abi_to_watched_contracts.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE watched_contracts - ADD COLUMN contract_abi json; \ No newline at end of file diff --git a/db/migrations/1512504078_add_nodes_table.down.sql b/db/migrations/1512504078_add_nodes_table.down.sql deleted file mode 100644 index c095b945..00000000 --- a/db/migrations/1512504078_add_nodes_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE nodes; \ No newline at end of file diff --git a/db/migrations/1512507280_add_node_fk_to_blocks.down.sql b/db/migrations/1512507280_add_node_fk_to_blocks.down.sql deleted file mode 100644 index 97e87635..00000000 --- a/db/migrations/1512507280_add_node_fk_to_blocks.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN node_id; \ No newline at end of file diff --git a/db/migrations/1512507280_add_node_fk_to_blocks.up.sql b/db/migrations/1512507280_add_node_fk_to_blocks.up.sql deleted file mode 100644 index 6e03577c..00000000 --- a/db/migrations/1512507280_add_node_fk_to_blocks.up.sql +++ /dev/null @@ -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); \ No newline at end of file diff --git a/db/migrations/1512595007_add_contract_hash_constraint_to_watched_contracts.down.sql b/db/migrations/1512595007_add_contract_hash_constraint_to_watched_contracts.down.sql deleted file mode 100644 index 70672822..00000000 --- a/db/migrations/1512595007_add_contract_hash_constraint_to_watched_contracts.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE watched_contracts - DROP CONSTRAINT contract_hash_uc; \ No newline at end of file diff --git a/db/migrations/1512595007_add_contract_hash_constraint_to_watched_contracts.up.sql b/db/migrations/1512595007_add_contract_hash_constraint_to_watched_contracts.up.sql deleted file mode 100644 index f27a54c0..00000000 --- a/db/migrations/1512595007_add_contract_hash_constraint_to_watched_contracts.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE watched_contracts - ADD CONSTRAINT contract_hash_uc UNIQUE (contract_hash); diff --git a/db/migrations/1513029953_add_logs_table.down.sql b/db/migrations/1513029953_add_logs_table.down.sql deleted file mode 100644 index c3866786..00000000 --- a/db/migrations/1513029953_add_logs_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE logs; \ No newline at end of file diff --git a/db/migrations/1513192766_add_cascade_delete_to_transactions.down.sql b/db/migrations/1513192766_add_cascade_delete_to_transactions.down.sql deleted file mode 100644 index 6546f2be..00000000 --- a/db/migrations/1513192766_add_cascade_delete_to_transactions.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1513192766_add_cascade_delete_to_transactions.up.sql b/db/migrations/1513192766_add_cascade_delete_to_transactions.up.sql deleted file mode 100644 index 50ca360c..00000000 --- a/db/migrations/1513192766_add_cascade_delete_to_transactions.up.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1513275969_add_cascade_delete_to_blocks.up.sql b/db/migrations/1513275969_add_cascade_delete_to_blocks.up.sql deleted file mode 100644 index 37ee1f18..00000000 --- a/db/migrations/1513275969_add_cascade_delete_to_blocks.up.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1513613036_add_is_final_to_blocks.down.sql b/db/migrations/1513613036_add_is_final_to_blocks.down.sql deleted file mode 100644 index 5a0b113c..00000000 --- a/db/migrations/1513613036_add_is_final_to_blocks.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN is_final; \ No newline at end of file diff --git a/db/migrations/1513613036_add_is_final_to_blocks.up.sql b/db/migrations/1513613036_add_is_final_to_blocks.up.sql deleted file mode 100644 index 667954ed..00000000 --- a/db/migrations/1513613036_add_is_final_to_blocks.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - ADD COLUMN is_final BOOLEAN; \ No newline at end of file diff --git a/db/migrations/1513781105_add_unique_constraint_blocks_node.down.sql b/db/migrations/1513781105_add_unique_constraint_blocks_node.down.sql deleted file mode 100644 index d72b7e91..00000000 --- a/db/migrations/1513781105_add_unique_constraint_blocks_node.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - DROP CONSTRAINT node_id_block_number_uc; \ No newline at end of file diff --git a/db/migrations/1513781105_add_unique_constraint_blocks_node.up.sql b/db/migrations/1513781105_add_unique_constraint_blocks_node.up.sql deleted file mode 100644 index 99c9293c..00000000 --- a/db/migrations/1513781105_add_unique_constraint_blocks_node.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - ADD CONSTRAINT node_id_block_number_uc UNIQUE (block_number, node_id); \ No newline at end of file diff --git a/db/migrations/1513783615_add_block_id_index_on_transactions_table.down.sql b/db/migrations/1513783615_add_block_id_index_on_transactions_table.down.sql deleted file mode 100644 index 214e4604..00000000 --- a/db/migrations/1513783615_add_block_id_index_on_transactions_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP INDEX block_id_index; \ No newline at end of file diff --git a/db/migrations/1513783615_add_block_id_index_on_transactions_table.up.sql b/db/migrations/1513783615_add_block_id_index_on_transactions_table.up.sql deleted file mode 100644 index 1e375eec..00000000 --- a/db/migrations/1513783615_add_block_id_index_on_transactions_table.up.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX block_id_index ON transactions (block_id); \ No newline at end of file diff --git a/db/migrations/1513783944_add_node_id_index_on_blocks_table.down.sql b/db/migrations/1513783944_add_node_id_index_on_blocks_table.down.sql deleted file mode 100644 index f8621c94..00000000 --- a/db/migrations/1513783944_add_node_id_index_on_blocks_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP INDEX node_id_index; \ No newline at end of file diff --git a/db/migrations/1513783944_add_node_id_index_on_blocks_table.up.sql b/db/migrations/1513783944_add_node_id_index_on_blocks_table.up.sql deleted file mode 100644 index a60623a4..00000000 --- a/db/migrations/1513783944_add_node_id_index_on_blocks_table.up.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX node_id_index ON blocks (node_id); \ No newline at end of file diff --git a/db/migrations/1513805096_tx_to_index.down.sql b/db/migrations/1513805096_tx_to_index.down.sql deleted file mode 100644 index cd501119..00000000 --- a/db/migrations/1513805096_tx_to_index.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP INDEX tx_to_index; \ No newline at end of file diff --git a/db/migrations/1513805096_tx_to_index.up.sql b/db/migrations/1513805096_tx_to_index.up.sql deleted file mode 100644 index d51eb6f2..00000000 --- a/db/migrations/1513805096_tx_to_index.up.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX tx_to_index ON transactions(tx_to); \ No newline at end of file diff --git a/db/migrations/1513805100_tx_from_index.down.sql b/db/migrations/1513805100_tx_from_index.down.sql deleted file mode 100644 index 5e0d00a0..00000000 --- a/db/migrations/1513805100_tx_from_index.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP INDEX tx_from_index; \ No newline at end of file diff --git a/db/migrations/1513805100_tx_from_index.up.sql b/db/migrations/1513805100_tx_from_index.up.sql deleted file mode 100644 index d56c117d..00000000 --- a/db/migrations/1513805100_tx_from_index.up.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX tx_from_index ON transactions(tx_from); \ No newline at end of file diff --git a/db/migrations/1514392444_add_miner.down.sql b/db/migrations/1514392444_add_miner.down.sql deleted file mode 100644 index 417ad684..00000000 --- a/db/migrations/1514392444_add_miner.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN block_miner; \ No newline at end of file diff --git a/db/migrations/1514392444_add_miner.up.sql b/db/migrations/1514392444_add_miner.up.sql deleted file mode 100644 index 2667365b..00000000 --- a/db/migrations/1514392444_add_miner.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - ADD COLUMN block_miner VARCHAR(42); \ No newline at end of file diff --git a/db/migrations/1514397430_add_extra_data.down.sql b/db/migrations/1514397430_add_extra_data.down.sql deleted file mode 100644 index 0da3cdeb..00000000 --- a/db/migrations/1514397430_add_extra_data.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN block_extra_data; \ No newline at end of file diff --git a/db/migrations/1514397430_add_extra_data.up.sql b/db/migrations/1514397430_add_extra_data.up.sql deleted file mode 100644 index 71839271..00000000 --- a/db/migrations/1514397430_add_extra_data.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - ADD COLUMN block_extra_data VARCHAR; \ No newline at end of file diff --git a/db/migrations/1514476024_add_block_reward_uncle_reward.down.sql b/db/migrations/1514476024_add_block_reward_uncle_reward.down.sql deleted file mode 100644 index ec96263f..00000000 --- a/db/migrations/1514476024_add_block_reward_uncle_reward.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN block_reward, - DROP COLUMN block_uncles_reward; diff --git a/db/migrations/1514476024_add_block_reward_uncle_reward.up.sql b/db/migrations/1514476024_add_block_reward_uncle_reward.up.sql deleted file mode 100644 index 447e53a6..00000000 --- a/db/migrations/1514476024_add_block_reward_uncle_reward.up.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE blocks - ADD COLUMN block_reward NUMERIC, - ADD COLUMN block_uncles_reward NUMERIC; diff --git a/db/migrations/1514502281_add_data_input_to_transactions.down.sql b/db/migrations/1514502281_add_data_input_to_transactions.down.sql deleted file mode 100644 index cbaddf86..00000000 --- a/db/migrations/1514502281_add_data_input_to_transactions.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE transactions - DROP COLUMN tx_input_data; \ No newline at end of file diff --git a/db/migrations/1514502281_add_data_input_to_transactions.up.sql b/db/migrations/1514502281_add_data_input_to_transactions.up.sql deleted file mode 100644 index 963d0c75..00000000 --- a/db/migrations/1514502281_add_data_input_to_transactions.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE transactions - ADD COLUMN tx_input_data VARCHAR; \ No newline at end of file diff --git a/db/migrations/1514564898_create_receipts_table.down.sql b/db/migrations/1514564898_create_receipts_table.down.sql deleted file mode 100644 index 4009cc9f..00000000 --- a/db/migrations/1514564898_create_receipts_table.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE receipts; - diff --git a/db/migrations/1514932205_add_transaction_id_index_to_receipts.down.sql b/db/migrations/1514932205_add_transaction_id_index_to_receipts.down.sql deleted file mode 100644 index 7fbd62b2..00000000 --- a/db/migrations/1514932205_add_transaction_id_index_to_receipts.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP INDEX transaction_id_index; diff --git a/db/migrations/1514932205_add_transaction_id_index_to_receipts.up.sql b/db/migrations/1514932205_add_transaction_id_index_to_receipts.up.sql deleted file mode 100644 index 5ae39214..00000000 --- a/db/migrations/1514932205_add_transaction_id_index_to_receipts.up.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX transaction_id_index ON receipts (transaction_id); \ No newline at end of file diff --git a/db/migrations/1515613181_add_fields_to_node.down.sql b/db/migrations/1515613181_add_fields_to_node.down.sql deleted file mode 100644 index 66ffb290..00000000 --- a/db/migrations/1515613181_add_fields_to_node.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE nodes - DROP COLUMN node_id, - DROP COLUMN client_name; \ No newline at end of file diff --git a/db/migrations/1515613181_add_fields_to_node.up.sql b/db/migrations/1515613181_add_fields_to_node.up.sql deleted file mode 100644 index 5396e26a..00000000 --- a/db/migrations/1515613181_add_fields_to_node.up.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE nodes - ADD COLUMN node_id VARCHAR(128), - ADD COLUMN client_name VARCHAR; \ No newline at end of file diff --git a/db/migrations/1515613715_update_node_index.down.sql b/db/migrations/1515613715_update_node_index.down.sql deleted file mode 100644 index 5c252c4b..00000000 --- a/db/migrations/1515613715_update_node_index.down.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1515613715_update_node_index.up.sql b/db/migrations/1515613715_update_node_index.up.sql deleted file mode 100644 index 6abf9347..00000000 --- a/db/migrations/1515613715_update_node_index.up.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1516050071_add_log_fk_constraint.down.sql b/db/migrations/1516050071_add_log_fk_constraint.down.sql deleted file mode 100644 index 55779b51..00000000 --- a/db/migrations/1516050071_add_log_fk_constraint.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1516648743_add_log_filters.down.sql b/db/migrations/1516648743_add_log_filters.down.sql deleted file mode 100644 index a28adeee..00000000 --- a/db/migrations/1516648743_add_log_filters.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE log_filters; \ No newline at end of file diff --git a/db/migrations/1516653373_add_watched_event_logs.down.sql b/db/migrations/1516653373_add_watched_event_logs.down.sql deleted file mode 100644 index 294d7bfe..00000000 --- a/db/migrations/1516653373_add_watched_event_logs.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW watched_event_logs; -DROP VIEW block_stats; diff --git a/db/migrations/1517538273_update_gas_limit_gas_used.down.sql b/db/migrations/1517538273_update_gas_limit_gas_used.down.sql deleted file mode 100644 index 1bdce02f..00000000 --- a/db/migrations/1517538273_update_gas_limit_gas_used.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1517538273_update_gas_limit_gas_used.up.sql b/db/migrations/1517538273_update_gas_limit_gas_used.up.sql deleted file mode 100644 index 7426a59b..00000000 --- a/db/migrations/1517538273_update_gas_limit_gas_used.up.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1517603663_rename_block_columns.down.sql b/db/migrations/1517603663_rename_block_columns.down.sql deleted file mode 100644 index 6993a276..00000000 --- a/db/migrations/1517603663_rename_block_columns.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1517603663_rename_block_columns.up.sql b/db/migrations/1517603663_rename_block_columns.up.sql deleted file mode 100644 index cbd572cf..00000000 --- a/db/migrations/1517603663_rename_block_columns.up.sql +++ /dev/null @@ -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; - - - - - - - - - - diff --git a/db/migrations/1517605676_update_tx_table_names.down.sql b/db/migrations/1517605676_update_tx_table_names.down.sql deleted file mode 100644 index f2060aae..00000000 --- a/db/migrations/1517605676_update_tx_table_names.down.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1517605676_update_tx_table_names.up.sql b/db/migrations/1517605676_update_tx_table_names.up.sql deleted file mode 100644 index 316fc593..00000000 --- a/db/migrations/1517605676_update_tx_table_names.up.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1517854395_update_log_filters_to_block_constraint.down.sql b/db/migrations/1517854395_update_log_filters_to_block_constraint.down.sql deleted file mode 100644 index 253d5849..00000000 --- a/db/migrations/1517854395_update_log_filters_to_block_constraint.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1517854395_update_log_filters_to_block_constraint.up.sql b/db/migrations/1517854395_update_log_filters_to_block_constraint.up.sql deleted file mode 100644 index 32fa00cb..00000000 --- a/db/migrations/1517854395_update_log_filters_to_block_constraint.up.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1520289493_update_eth18_types.down.sql b/db/migrations/1520289493_update_eth18_types.down.sql deleted file mode 100644 index 439f5f9e..00000000 --- a/db/migrations/1520289493_update_eth18_types.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - ALTER COLUMN size TYPE BIGINT USING size::BIGINT; diff --git a/db/migrations/1520289493_update_eth18_types.up.sql b/db/migrations/1520289493_update_eth18_types.up.sql deleted file mode 100644 index 529fe9c8..00000000 --- a/db/migrations/1520289493_update_eth18_types.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - ALTER COLUMN size TYPE VARCHAR USING size::VARCHAR; diff --git a/db/migrations/1521640994_rename_node_table.down.sql b/db/migrations/1521640994_rename_node_table.down.sql deleted file mode 100644 index 70d459c2..00000000 --- a/db/migrations/1521640994_rename_node_table.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1521640994_rename_node_table.up.sql b/db/migrations/1521640994_rename_node_table.up.sql deleted file mode 100644 index 3b6343c0..00000000 --- a/db/migrations/1521640994_rename_node_table.up.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1525122581_associate_receipts_with_blocks.up.sql b/db/migrations/1525122581_associate_receipts_with_blocks.up.sql deleted file mode 100644 index 51d22747..00000000 --- a/db/migrations/1525122581_associate_receipts_with_blocks.up.sql +++ /dev/null @@ -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; diff --git a/db/migrations/1525464568_add_eth_node_fingerprint_to_blocks.down.sql b/db/migrations/1525464568_add_eth_node_fingerprint_to_blocks.down.sql deleted file mode 100644 index f1980bec..00000000 --- a/db/migrations/1525464568_add_eth_node_fingerprint_to_blocks.down.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE blocks - DROP COLUMN eth_node_fingerprint; \ No newline at end of file diff --git a/db/migrations/1528317902_create_token_supply_table.down.sql b/db/migrations/1528317902_create_token_supply_table.down.sql deleted file mode 100644 index fdc23208..00000000 --- a/db/migrations/1528317902_create_token_supply_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE token_supply; \ No newline at end of file diff --git a/db/migrations/1531758090_create_headers_table.down.sql b/db/migrations/1531758090_create_headers_table.down.sql deleted file mode 100644 index d9b283f9..00000000 --- a/db/migrations/1531758090_create_headers_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE public.headers; \ No newline at end of file diff --git a/db/migrations/1532468317_create_checked_headers_table.down.sql b/db/migrations/1532468317_create_checked_headers_table.down.sql deleted file mode 100644 index d9bf78df..00000000 --- a/db/migrations/1532468317_create_checked_headers_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE public.checked_headers; \ No newline at end of file diff --git a/db/migrations/1532468318_create_maker_schema.down.sql b/db/migrations/1532468318_create_maker_schema.down.sql deleted file mode 100644 index cb59a3da..00000000 --- a/db/migrations/1532468318_create_maker_schema.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP SCHEMA maker; diff --git a/db/migrations/1532468318_create_maker_schema.up.sql b/db/migrations/1532468318_create_maker_schema.up.sql deleted file mode 100644 index 87c8fa51..00000000 --- a/db/migrations/1532468318_create_maker_schema.up.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE SCHEMA maker; - diff --git a/db/migrations/1532468319_create_flip_kick.down.sql b/db/migrations/1532468319_create_flip_kick.down.sql deleted file mode 100644 index bde9fdb0..00000000 --- a/db/migrations/1532468319_create_flip_kick.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.flip_kick; - -ALTER TABLE public.checked_headers - DROP COLUMN flip_kick_checked; \ No newline at end of file diff --git a/db/migrations/1533844125_create_frob.down.sql b/db/migrations/1533844125_create_frob.down.sql deleted file mode 100644 index 8c8d394e..00000000 --- a/db/migrations/1533844125_create_frob.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.frob; - -ALTER TABLE public.checked_headers - DROP COLUMN frob_checked; \ No newline at end of file diff --git a/db/migrations/1534275305_create_price_feeds_table.down.sql b/db/migrations/1534275305_create_price_feeds_table.down.sql deleted file mode 100644 index 98b365c6..00000000 --- a/db/migrations/1534275305_create_price_feeds_table.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE maker.price_feeds; \ No newline at end of file diff --git a/db/migrations/1534295712_create_tend.down.sql b/db/migrations/1534295712_create_tend.down.sql deleted file mode 100644 index d473b29a..00000000 --- a/db/migrations/1534295712_create_tend.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.tend; - -ALTER TABLE public.checked_headers - DROP COLUMN tend_checked; \ No newline at end of file diff --git a/db/migrations/1534295713_create_bite.down.sql b/db/migrations/1534295713_create_bite.down.sql deleted file mode 100644 index 3245eedd..00000000 --- a/db/migrations/1534295713_create_bite.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.bite; - -ALTER TABLE public.checked_headers - DROP COLUMN bite_checked; \ No newline at end of file diff --git a/db/migrations/1534799167_create_dent.down.sql b/db/migrations/1534799167_create_dent.down.sql deleted file mode 100644 index 54e9430a..00000000 --- a/db/migrations/1534799167_create_dent.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.dent; - -ALTER TABLE public.checked_headers - DROP COLUMN dent_checked; \ No newline at end of file diff --git a/db/migrations/1535667935_create_pit_file.down.sql b/db/migrations/1535667935_create_pit_file.down.sql deleted file mode 100644 index 41bb5693..00000000 --- a/db/migrations/1535667935_create_pit_file.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1536267596_create_vat_init.down.sql b/db/migrations/1536267596_create_vat_init.down.sql deleted file mode 100644 index 0d41ae29..00000000 --- a/db/migrations/1536267596_create_vat_init.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.vat_init; - -ALTER TABLE public.checked_headers - DROP COLUMN vat_init_checked; \ No newline at end of file diff --git a/db/migrations/1536603967_create_drip_file.down.sql b/db/migrations/1536603967_create_drip_file.down.sql deleted file mode 100644 index 0ee02482..00000000 --- a/db/migrations/1536603967_create_drip_file.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1536615440_create_deal.down.sql b/db/migrations/1536615440_create_deal.down.sql deleted file mode 100644 index dc69c192..00000000 --- a/db/migrations/1536615440_create_deal.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.deal; - -ALTER TABLE public.checked_headers - DROP COLUMN deal_checked; \ No newline at end of file diff --git a/db/migrations/1536702963_add_price_feed_trigger.down.sql b/db/migrations/1536702963_add_price_feed_trigger.down.sql deleted file mode 100644 index 456f014e..00000000 --- a/db/migrations/1536702963_add_price_feed_trigger.down.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TRIGGER notify_pricefeeds ON maker.price_feeds; diff --git a/db/migrations/1536710319_create_drip_drip.down.sql b/db/migrations/1536710319_create_drip_drip.down.sql deleted file mode 100644 index cce76663..00000000 --- a/db/migrations/1536710319_create_drip_drip.down.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.drip_drip; - -ALTER TABLE public.checked_headers - DROP COLUMN drip_drip_checked; \ No newline at end of file diff --git a/db/migrations/1536765047_create_cat_file.down.sql b/db/migrations/1536765047_create_cat_file.down.sql deleted file mode 100644 index 6a58fbc1..00000000 --- a/db/migrations/1536765047_create_cat_file.down.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/db/migrations/1536942529_create_flop_kick.down.sql b/db/migrations/1536942529_create_flop_kick.down.sql deleted file mode 100644 index cf042f3e..00000000 --- a/db/migrations/1536942529_create_flop_kick.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.flop_kick; -ALTER TABLE public.checked_headers - DROP COLUMN flop_kick_checked; \ No newline at end of file diff --git a/db/migrations/1538396815_create_vat_move.down.sql b/db/migrations/1538396815_create_vat_move.down.sql deleted file mode 100644 index 2366c0ef..00000000 --- a/db/migrations/1538396815_create_vat_move.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_move; -ALTER TABLE public.checked_headers - DROP COLUMN vat_move_checked; \ No newline at end of file diff --git a/db/migrations/1538510582_create_vat_fold_table.down.sql b/db/migrations/1538510582_create_vat_fold_table.down.sql deleted file mode 100644 index d63b6597..00000000 --- a/db/migrations/1538510582_create_vat_fold_table.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_fold; -ALTER TABLE public.checked_headers - DROP COLUMN vat_fold_checked; diff --git a/db/migrations/1538671228_create_vat_heal.down.sql b/db/migrations/1538671228_create_vat_heal.down.sql deleted file mode 100644 index 20161cab..00000000 --- a/db/migrations/1538671228_create_vat_heal.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_heal; -ALTER TABLE public.checked_headers - DROP COLUMN vat_heal_checked; diff --git a/db/migrations/1538679495_create_vat_toll.down.sql b/db/migrations/1538679495_create_vat_toll.down.sql deleted file mode 100644 index 5c291a92..00000000 --- a/db/migrations/1538679495_create_vat_toll.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_toll; -ALTER TABLE public.checked_headers - DROP COLUMN vat_toll_checked; \ No newline at end of file diff --git a/db/migrations/1538689084_create_vat_tune.down.sql b/db/migrations/1538689084_create_vat_tune.down.sql deleted file mode 100644 index 1d1a34ec..00000000 --- a/db/migrations/1538689084_create_vat_tune.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_tune; -ALTER TABLE public.checked_headers - DROP COLUMN vat_tune_checked; \ No newline at end of file diff --git a/db/migrations/1539033620_create_vat_grab.down.sql b/db/migrations/1539033620_create_vat_grab.down.sql deleted file mode 100644 index eade21a1..00000000 --- a/db/migrations/1539033620_create_vat_grab.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_grab; -ALTER TABLE public.checked_headers - DROP COLUMN vat_grab_checked; \ No newline at end of file diff --git a/db/migrations/1539276289_create_vat_flux_table.down.sql b/db/migrations/1539276289_create_vat_flux_table.down.sql deleted file mode 100644 index c42423f1..00000000 --- a/db/migrations/1539276289_create_vat_flux_table.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_flux; -ALTER TABLE public.checked_headers - DROP COLUMN vat_flux_checked; diff --git a/db/migrations/1539638109_create_vat_slip.down.sql b/db/migrations/1539638109_create_vat_slip.down.sql deleted file mode 100644 index 948c0094..00000000 --- a/db/migrations/1539638109_create_vat_slip.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vat_slip; -ALTER TABLE public.checked_headers - DROP COLUMN vat_slip_checked; \ No newline at end of file diff --git a/db/migrations/1540297136_create_vow_flog.down.sql b/db/migrations/1540297136_create_vow_flog.down.sql deleted file mode 100644 index bdbd47ec..00000000 --- a/db/migrations/1540297136_create_vow_flog.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.vow_flog; -ALTER TABLE public.checked_headers - DROP COLUMN vow_flog_checked; \ No newline at end of file diff --git a/db/migrations/1541525500_create_flap_kick.down.sql b/db/migrations/1541525500_create_flap_kick.down.sql deleted file mode 100644 index 48d4b5c1..00000000 --- a/db/migrations/1541525500_create_flap_kick.down.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE maker.flap_kick; -ALTER TABLE public.checked_headers - DROP COLUMN flap_kick_checked; \ No newline at end of file diff --git a/db/migrations/1542222088_drop_pit_file_stability_fee.up.sql b/db/migrations/1542222088_drop_pit_file_stability_fee.up.sql deleted file mode 100644 index 2d43642d..00000000 --- a/db/migrations/1542222088_drop_pit_file_stability_fee.up.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE maker.pit_file_stability_fee; - -ALTER TABLE public.checked_headers - DROP COLUMN pit_file_stability_fee_checked; diff --git a/db/schema.sql b/db/schema.sql index c245a293..a7871549 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 10.3 --- Dumped by pg_dump version 10.5 +-- Dumped from database version 10.5 +-- Dumped by pg_dump version 11.1 SET statement_timeout = 0; SET lock_timeout = 0; @@ -22,20 +22,6 @@ SET row_security = off; CREATE SCHEMA maker; --- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; - - -- -- Name: notify_pricefeed(); Type: FUNCTION; Schema: public; Owner: - -- @@ -1227,6 +1213,38 @@ CREATE TABLE public.eth_nodes ( ); +-- +-- Name: goose_db_version; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.goose_db_version ( + id integer NOT NULL, + version_id bigint NOT NULL, + is_applied boolean NOT NULL, + tstamp timestamp without time zone DEFAULT now() +); + + +-- +-- Name: goose_db_version_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.goose_db_version_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: goose_db_version_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.goose_db_version_id_seq OWNED BY public.goose_db_version.id; + + -- -- Name: headers; Type: TABLE; Schema: public; Owner: - -- @@ -1378,16 +1396,6 @@ CREATE SEQUENCE public.receipts_id_seq ALTER SEQUENCE public.receipts_id_seq OWNED BY public.receipts.id; --- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.schema_migrations ( - version bigint NOT NULL, - dirty boolean NOT NULL -); - - -- -- Name: token_supply; Type: TABLE; Schema: public; Owner: - -- @@ -1729,6 +1737,13 @@ ALTER TABLE ONLY public.checked_headers ALTER COLUMN id SET DEFAULT nextval('pub ALTER TABLE ONLY public.eth_nodes ALTER COLUMN id SET DEFAULT nextval('public.nodes_id_seq'::regclass); +-- +-- Name: goose_db_version id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.goose_db_version ALTER COLUMN id SET DEFAULT nextval('public.goose_db_version_id_seq'::regclass); + + -- -- Name: headers id; Type: DEFAULT; Schema: public; Owner: - -- @@ -2274,6 +2289,14 @@ ALTER TABLE ONLY public.eth_nodes ADD CONSTRAINT eth_node_uc UNIQUE (genesis_block, network_id, eth_node_id); +-- +-- Name: goose_db_version goose_db_version_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.goose_db_version + ADD CONSTRAINT goose_db_version_pkey PRIMARY KEY (id); + + -- -- Name: headers headers_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2314,14 +2337,6 @@ ALTER TABLE ONLY public.receipts ADD CONSTRAINT receipts_pkey PRIMARY KEY (id); --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - -- -- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- diff --git a/scripts/create_migration b/scripts/create_migration deleted file mode 100755 index 27e4a1bc..00000000 --- a/scripts/create_migration +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ $# -eq 1 ] -then - $GOPATH/bin/migrate create -dir ./db/migrations -ext sql $1 -else - echo "**An Error Occurred**" - echo "Usage: ./scripts/create_migration " -fi