Reputation: 265
When importing or exporting Databases using Taps in heroku , is it necessary that we need to perform heroku run rake db:migrate command?what is the difference between heroku push and heroku migrate? can anyone clear me with this?,thank you. . .
Upvotes: 1
Views: 1412
Reputation: 1455
The heroku docs on this are pretty good https://devcenter.heroku.com/articles/taps
but I can see that its not totally clear whether you need to run the migration. You are essentially taking your local database and pushing it up as a complete replacement, and it will create the tables and fill them, so running the migration against heroku is not necessary.
I was helping someone launch their app minutes before a major demo, and we had issues where running the migrations on heroku was failing (code/dependencies on his part), so reverting to db:push allowed us to get the db structure and local data up in time for the demo.
Give it a try
Upvotes: 1
Reputation: 698
push
is a Git command. Each Heroku app is a Git repository, and pushing to it from your local repository triggers the deployment.
db:migrate
is a Rake task. Rails uses Rake to simplify common tasks for managing a Rails app. This has nothing to do with Git or pushing to Heroku. When you run heroku run [something]
, your Heroku app spawns a one-off process to run the specified command. In this case, it is Rake. db:migrate
is the Rake task for running your Rails migrations to update your database schema.
Whether you run you migrations before importing or exporting your database is up to you and depends on whether you have migrations that need to be applied.
Upvotes: 0