Heroku: How to push seeds.rb to existing rails app?

前端 未结 4 1129
北海茫月
北海茫月 2020-12-29 07:20

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 do not want to re-input the mass d

相关标签:
4条回答
  • 2020-12-29 07:58

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

    heroku run rake db:seed
    
    0 讨论(0)
  • 2020-12-29 08:00

    I'll just add, because I haven't seen it yet. heroku run rails db:seed Will accomplish the same task.

    0 讨论(0)
  • 2020-12-29 08:09

    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

    0 讨论(0)
  • 2020-12-29 08:14

    you have to be sure no migration is pending if no pending

    just do

    heroku run rake db:migrate
    

    and it will word perfectly

    0 讨论(0)
提交回复
热议问题