-
Notifications
You must be signed in to change notification settings - Fork 108
Add a step to check for migrations and migrate DB if needed #434
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,27 @@ DOCKER := docker | |
DOCKER_COMPOSE := docker-compose | ||
|
||
.PHONY: all | ||
all: run | ||
all: run | ||
|
||
.PHONY: nuke | ||
nuke: | ||
nuke: | ||
${DOCKER} system prune -a --volumes | ||
|
||
.PHONY: minty-fresh | ||
minty-fresh: | ||
.PHONY: minty-fresh | ||
minty-fresh: | ||
${DOCKER_COMPOSE} down --rmi all --volumes | ||
|
||
.PHONY: rmi | ||
rmi: | ||
rmi: | ||
${DOCKER} images -q | xargs docker rmi -f | ||
|
||
.PHONY: rmdi | ||
rmdi: | ||
rmdi: | ||
${DOCKER} images -a --filter=dangling=true -q | xargs ${DOCKER} rmi | ||
|
||
.PHONY: rm-exited-containers | ||
rm-exited-containers: | ||
${DOCKER} ps -a -q -f status=exited | xargs ${DOCKER} rm -v | ||
rm-exited-containers: | ||
${DOCKER} ps -a -q -f status=exited | xargs ${DOCKER} rm -v | ||
|
||
.PHONY: fresh-restart | ||
fresh-restart: minty-fresh setup test run | ||
|
@@ -95,7 +95,10 @@ bundle: | |
|
||
setup: build db_create db_migrate | ||
|
||
publish: build | ||
migrate_if_needed: | ||
bash -c 'if docker-compose run ${RAILS_CONTAINER} rake db:migrate:status | grep "^\s*down"; then docker-compose run ${RAILS_CONTAINER} rake db:migrate; fi' | ||
|
||
publish: build migrate_if_needed | ||
bin/publish | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 I'm not super familiar with the deployed production environment. Looking at the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. I thought maybe the docker container that build was run on would then be promoted to production. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there's someone who could walk me through/explain, I would love to write up documentation. |
||
|
||
upgrade: publish | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recently discovered the
db:abort_if_pending_migrations
task which pretty much does what it says: exits the rake execution with an error if there are pending migrations.And now that I know about it, of course I want to use it! What do you think about this?