2

I'm working on an application which uses data from db which has to be populated prior to the application being able to run. What I have to do is to populate few tables with few thousand rows but I'm not sure how I would do that in heroku because I have limited access to db for loading data.

What is the preferred way to do this?

Regards, Johann

gugguson
  • 819
  • 2
  • 13
  • 32

2 Answers2

3

You can populate a Postgres database locally and then push it to heroku with heroku db:push see heroku help db:push

nikola
  • 5,286
  • 3
  • 22
  • 19
John Beynon
  • 37,398
  • 8
  • 88
  • 97
2

You may want to look into seeds, there's also a Railscast. I've never used this before, so you may alternately want to…

Create a rake task to suit your specific need. That way you can add the task to your Rails application and run heroku rake mytask. Here's a rake tutorial, and a Railscast on rake tasks to help get you started.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214