Title

Thursday, 5 February 2015

How to push seeds.rb to existed rails app (on Heroku)?


I store all my app's data in seeds.rb locally. However, after I pushing everything to Heroku, the app works well, but without any data. I donot want to re-input the mass data again, so does anyone have any ways to help me?

Answer

If you have changed migrations then first you need to do is run migration

heroku run rake db:migrate

then

heroku run rake db:seed

If you don't have any data in database the I would suggest following is, But caution it will remove all current data from heroku database.

heroku run rake db:setup

Hope this helps you

Answer2

If you push the app to heroku, you can seed the database with the following command.

heroku run rake db:seed

No comments:

Post a Comment