-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Heroku deploys #654
Fix Heroku deploys #654
Conversation
Brilliant catch! 💾 |
Should we really run migrations on deployment? Shouldn't we rather use |
app.json
Outdated
@@ -1,6 +1,7 @@ | |||
{ | |||
"name": "workshop-portal", | |||
"scripts": { | |||
"postdeploy": "bundle exec rake db:schema:load db:seed" |
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.
Depending on when this setting applies we might want to add db:populate_sample_data
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.
Oh, right!
I'll add more info soon.
@@ -1,6 +1,7 @@ | |||
{ | |||
"name": "workshop-portal", | |||
"scripts": { | |||
"postdeploy": "bundle exec rake db:schema:load db:seed db:populate_sample_data" |
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.
This is called once on a review app whenever a new merge request - and a review app - is created.
@@ -1 +1,2 @@ | |||
release: bundle exec rake db:migrate |
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.
This is called "all the time" on review apps as well as on the dev deployment. As per the docs, this is called after:
- An app build
- A config var set by a user
- A pipeline promotion
- A rollback
- A release via the platform API
I figured it would make sense to run migrations so the dev is always up to date.
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.
The only time it doesn't make sense to me is a rollback. Wouldn't you need to call rake db:rollback
accordingly then? Given that a migration was added in that code, you'd want to change that back as well, wouldn't you? Or does rollback refer to a step back in the pipeline (like from dev to staging)? And if that is the case, in this example is this then called on the dev or the staging pipeline step?
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 think rollback means that you deploy an old commit over the current commit. I agree migrating is the wrong approach then. However, I see no other way to solve this currently. I think we should ignore this edge case.
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.
So finally: Works and should be merged asap ☝️
Probably due to a Postgres update, the database now is more restrictive when it comes to changing a column's type. The Heroku deployment failed for this reason. I have already confirmed this fix to be working by manually applying it to the currently deployed version. You'll see it running over here: http://workshopportal.herokuapp.com/
Things left to do:
rake db:migrate
works afterwards)