Fix migrations naming after merge
This commit is contained in:
commit
bc68969abb
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ BIN = $(GOPATH)/bin
|
|||||||
## Migration tool
|
## Migration tool
|
||||||
GOOSE = $(BIN)/goose
|
GOOSE = $(BIN)/goose
|
||||||
$(BIN)/goose:
|
$(BIN)/goose:
|
||||||
GO111MODULE=off go get -u github.com/pressly/goose/cmd/goose
|
go get -u github.com/pressly/goose/cmd/goose
|
||||||
|
|
||||||
.PHONY: installtools
|
.PHONY: installtools
|
||||||
installtools: | $(GOOSE)
|
installtools: | $(GOOSE)
|
||||||
|
@ -27,7 +27,7 @@ Schemas and utils for IPLD ETH Postgres database
|
|||||||
* Edit [startup_script.sh](./scripts/startup_script.sh) to change the number of migrations to be run:
|
* Edit [startup_script.sh](./scripts/startup_script.sh) to change the number of migrations to be run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up-to 21
|
./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up-to 24
|
||||||
```
|
```
|
||||||
|
|
||||||
* In another `ipld-eth-db` terminal window, build an image `migrations-test` using [Dockerfile](./db/Dockerfile):
|
* In another `ipld-eth-db` terminal window, build an image `migrations-test` using [Dockerfile](./db/Dockerfile):
|
||||||
|
5
db/migrations/00017_create_eth_meta_schema.sql
Normal file
5
db/migrations/00017_create_eth_meta_schema.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE SCHEMA eth_meta;
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP SCHEMA eth_meta;
|
10
db/migrations/00018_create_watched_addresses_table.sql
Normal file
10
db/migrations/00018_create_watched_addresses_table.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE eth_meta.watched_addresses (
|
||||||
|
address VARCHAR(66) PRIMARY KEY,
|
||||||
|
created_at BIGINT NOT NULL,
|
||||||
|
watched_at BIGINT NOT NULL,
|
||||||
|
last_filled_at BIGINT NOT NULL DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE eth_meta.watched_addresses;
|
10
db/migrations/00019_create_known_gaps_table.sql
Normal file
10
db/migrations/00019_create_known_gaps_table.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE eth_meta.known_gaps (
|
||||||
|
starting_block_number bigint PRIMARY KEY,
|
||||||
|
ending_block_number bigint,
|
||||||
|
checked_out boolean,
|
||||||
|
processing_key bigint
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE eth_meta.known_gaps;
|
47
schema.sql
47
schema.sql
@ -37,6 +37,13 @@ COMMENT ON EXTENSION timescaledb IS 'Enables scalable inserts and complex querie
|
|||||||
CREATE SCHEMA eth;
|
CREATE SCHEMA eth;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: eth_meta; Type: SCHEMA; Schema: -; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SCHEMA eth_meta;
|
||||||
|
|
||||||
|
|
||||||
SET default_tablespace = '';
|
SET default_tablespace = '';
|
||||||
|
|
||||||
SET default_table_access_method = heap;
|
SET default_table_access_method = heap;
|
||||||
@ -534,6 +541,30 @@ CREATE TABLE eth.uncle_cids (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: known_gaps; Type: TABLE; Schema: eth_meta; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE eth_meta.known_gaps (
|
||||||
|
starting_block_number bigint NOT NULL,
|
||||||
|
ending_block_number bigint,
|
||||||
|
checked_out boolean,
|
||||||
|
processing_key bigint
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: watched_addresses; Type: TABLE; Schema: eth_meta; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE eth_meta.watched_addresses (
|
||||||
|
address character varying(66) NOT NULL,
|
||||||
|
created_at bigint NOT NULL,
|
||||||
|
watched_at bigint NOT NULL,
|
||||||
|
last_filled_at bigint DEFAULT 0 NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: blocks; Type: TABLE; Schema: public; Owner: -
|
-- Name: blocks; Type: TABLE; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -695,6 +726,22 @@ ALTER TABLE ONLY eth.uncle_cids
|
|||||||
ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (block_hash, block_number);
|
ADD CONSTRAINT uncle_cids_pkey PRIMARY KEY (block_hash, block_number);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: known_gaps known_gaps_pkey; Type: CONSTRAINT; Schema: eth_meta; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY eth_meta.known_gaps
|
||||||
|
ADD CONSTRAINT known_gaps_pkey PRIMARY KEY (starting_block_number);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: watched_addresses watched_addresses_pkey; Type: CONSTRAINT; Schema: eth_meta; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY eth_meta.watched_addresses
|
||||||
|
ADD CONSTRAINT watched_addresses_pkey PRIMARY KEY (address);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -9,7 +9,7 @@ VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME
|
|||||||
echo "Connecting with: $VDB_PG_CONNECT"
|
echo "Connecting with: $VDB_PG_CONNECT"
|
||||||
sleep 15
|
sleep 15
|
||||||
echo "Running database migrations"
|
echo "Running database migrations"
|
||||||
./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up-to 21
|
./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up-to 24
|
||||||
|
|
||||||
# If the db migrations ran without err
|
# If the db migrations ran without err
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user