Pushing a single table to Heroku

前端 未结 3 602
我在风中等你
我在风中等你 2021-02-06 00:27

I am aware of the heroku pg:push command which pushes an entire database up to Heroku.

Now that I am launching my product, I would like to be able to push u

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-06 00:53

    If I understand correctly, you just need a single database table with its locally created data pushed to your Rails production app. Maybe this is a simplistic approach, but you could create a migration for your table and then populate using db/seeds.rb.

    After you've populated the seeds.rb file and pushed your repo to heroku:

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

    Also, if your local table has a ton of data and you're using Rails 4, check out the seed dump gem: https://github.com/rroblak/seed_dump. This will take your existing db data and map it to the seed format.

提交回复
热议问题