Dru
Dru

Reputation: 9820

Heroku Migrate Database Changes

I've made changes to my app, including adding models and adding columns to a pre-existing model. I'm using rails 3.1 and I'm aware that I must precompile my assets before deploying. Once I run git push heroku master and heroku rake db:migrate should I expect any errors?

I'm trying keep downtime to a minimum because users be interacting with the site during deployment.

Update

Everything seems to be fine. Push & Rake DB did it.

Upvotes: 3

Views: 1175

Answers (3)

Rameshwar Vyevhare
Rameshwar Vyevhare

Reputation: 2759

It is best practice to put site in maintenance mode while deploying

heroku maintenance:on

once you done with it then can

heroku maintenance:off

Upvotes: 0

Jayson Lane
Jayson Lane

Reputation: 2828

One thing you might want to look into is putting the app into maintenance mode while you're doing the update. Instead of hitting users with unpredictable results, you can minimize confusion by popping up a maintenance message. You can also customize it.

You can read about how here: http://devcenter.heroku.com/articles/maintenance-mode

Upvotes: 3

John Hinnegan
John Hinnegan

Reputation: 5962

First, I would test this out on a dev environment (still on Heroku). It's the only real way to be sure you're not going to have errors.

Second, Heroku tries to precompile your assets for you, so usually you don't have to do anything. That said, it only works in the 'base case', any changes you make usually break it, and often your app will be looking for an 'all.css' in production. So you probably have to try it, and then troubleshoot errors from the logs on a case by case.

Third, making changes while users are live always increases risk. If you really care, I'd do this off hours. A ruby version change I especially avoid peak time deployments.

Last point is that if you need to do migrations for your new code to work, you will have interruption to live users. I am unaware of any way to push & migrate in a single command. There will always be a small time delta between the push and the migrate in which, if you're serving live traffic, will have new code with old schema which probably causes errors.

Hope this helps.

Upvotes: 0

Related Questions