forked from cerc-io/ipld-eth-server
Fixes migration location for goose
This commit is contained in:
parent
deb64b8701
commit
afe8b3c999
29
Makefile
29
Makefile
@ -51,10 +51,8 @@ test: | $(GINKGO) $(LINT)
|
|||||||
go fmt ./...
|
go fmt ./...
|
||||||
dropdb --if-exists $(TEST_DB)
|
dropdb --if-exists $(TEST_DB)
|
||||||
createdb $(TEST_DB)
|
createdb $(TEST_DB)
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations "$(TEST_CONNECT_STRING)" up
|
||||||
$(GOOSE) postgres "$(TEST_CONNECT_STRING)" up
|
$(GOOSE) -dir db/migrations "$(TEST_CONNECT_STRING)" reset
|
||||||
cd db/migrations/;\
|
|
||||||
$(GOOSE) postgres "$(TEST_CONNECT_STRING)" reset
|
|
||||||
make migrate NAME=$(TEST_DB)
|
make migrate NAME=$(TEST_DB)
|
||||||
$(GINKGO) -r --skipPackage=integration_tests,integration
|
$(GINKGO) -r --skipPackage=integration_tests,integration
|
||||||
|
|
||||||
@ -64,10 +62,8 @@ integrationtest: | $(GINKGO) $(LINT)
|
|||||||
go fmt ./...
|
go fmt ./...
|
||||||
dropdb --if-exists $(TEST_DB)
|
dropdb --if-exists $(TEST_DB)
|
||||||
createdb $(TEST_DB)
|
createdb $(TEST_DB)
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations "$(TEST_CONNECT_STRING)" up
|
||||||
$(GOOSE) postgres "$(TEST_CONNECT_STRING)" up
|
$(GOOSE) -dir db/migrations "$(TEST_CONNECT_STRING)" reset
|
||||||
cd db/migrations/;\
|
|
||||||
$(GOOSE) postgres "$(TEST_CONNECT_STRING)" reset
|
|
||||||
make migrate NAME=$(TEST_DB)
|
make migrate NAME=$(TEST_DB)
|
||||||
$(GINKGO) -r integration_test/
|
$(GINKGO) -r integration_test/
|
||||||
|
|
||||||
@ -105,41 +101,36 @@ checkmigname:
|
|||||||
## Rollback the last migration
|
## Rollback the last migration
|
||||||
.PHONY: rollback
|
.PHONY: rollback
|
||||||
rollback: $(GOOSE) checkdbvars
|
rollback: $(GOOSE) checkdbvars
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations postgres "$(CONNECT_STRING)" down
|
||||||
$(GOOSE) postgres "$(CONNECT_STRING)" down
|
|
||||||
pg_dump -O -s $(CONNECT_STRING) > db/schema.sql
|
pg_dump -O -s $(CONNECT_STRING) > db/schema.sql
|
||||||
|
|
||||||
|
|
||||||
## Rollbackt to a select migration (id/timestamp)
|
## Rollbackt to a select migration (id/timestamp)
|
||||||
.PHONY: rollback_to
|
.PHONY: rollback_to
|
||||||
rollback_to: $(GOOSE) checkmigration checkdbvars
|
rollback_to: $(GOOSE) checkmigration checkdbvars
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations postgres "$(CONNECT_STRING)" down-to "$(MIGRATION)"
|
||||||
$(GOOSE) postgres "$(CONNECT_STRING)" down-to "$(MIGRATION)"
|
|
||||||
|
|
||||||
## Apply all migrations not already run
|
## Apply all migrations not already run
|
||||||
.PHONY: migrate
|
.PHONY: migrate
|
||||||
migrate: $(GOOSE) checkdbvars
|
migrate: $(GOOSE) checkdbvars
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations postgres "$(CONNECT_STRING)" up
|
||||||
$(GOOSE) postgres "$(CONNECT_STRING)" up
|
|
||||||
pg_dump -O -s $(CONNECT_STRING) > db/schema.sql
|
pg_dump -O -s $(CONNECT_STRING) > db/schema.sql
|
||||||
|
|
||||||
## Create a new migration file
|
## Create a new migration file
|
||||||
.PHONY: new_migration
|
.PHONY: new_migration
|
||||||
new_migration: $(GOOSE) checkmigname
|
new_migration: $(GOOSE) checkmigname
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations create $(NAME) sql
|
||||||
$(GOOSE) create $(NAME) sql
|
|
||||||
|
|
||||||
## Check which migrations are applied at the moment
|
## Check which migrations are applied at the moment
|
||||||
.PHONY: migration_status
|
.PHONY: migration_status
|
||||||
migration_status: $(GOOSE) checkdbvars
|
migration_status: $(GOOSE) checkdbvars
|
||||||
cd db/migrations;\
|
$(GOOSE) -dir db/migrations postgres "$(CONNECT_STRING)" status
|
||||||
$(GOOSE) postgres "$(CONNECT_STRING)" status
|
|
||||||
|
|
||||||
# Convert timestamped migrations to versioned (to be run in CI);
|
# Convert timestamped migrations to versioned (to be run in CI);
|
||||||
# merge timestamped files to prevent conflict
|
# merge timestamped files to prevent conflict
|
||||||
.PHONY: version_migrations
|
.PHONY: version_migrations
|
||||||
version_migrations:
|
version_migrations:
|
||||||
cd db/migrations; $(GOOSE) fix
|
$(GOOSE) -dir db/migrations fix
|
||||||
|
|
||||||
# Import a psql schema to the database
|
# Import a psql schema to the database
|
||||||
.PHONY: import
|
.PHONY: import
|
||||||
|
Loading…
Reference in New Issue
Block a user