Nick Ginanto
Nick Ginanto

Reputation: 32190

adding migration to heroku forces reset?

Every time I add a migration to a model, heroku seems to be unaware of that only until I do heroku rake db:reset / pg:reset

What is the procedure I must to to add for instance a :last_name to a user model and that I won't have to reset the DB afterwards?

the actions I know are:

rails generate migration add_lastname_to_users last_name:string

and then

git push heroku
heroku rake db:migrate

Am I missing something?

thanks

Upvotes: 0

Views: 381

Answers (2)

Nick Ginanto
Nick Ginanto

Reputation: 32190

forgot about this question..

after rake run db:migrate you must do heroku restart for the schema changes to take affect.

Upvotes: 0

stephenmurdoch
stephenmurdoch

Reputation: 34643

yep, try heroku run rake db:migrate

note, you need to use heroku run on latest stacks

the advantage is that you can chain rake tasks, i.e.

heroku run rake db:migrate rake db:seed rake db:whatever

without needing myriad &&'s

Upvotes: 1

Related Questions