1 thought on “Fill up database”

  1. I would recommend writing a simple Rake task to do this. Assuming the data from the CSV is intended for a single table, and it’s a list of user names and email addresses.

    task :import_from_csv => :environment do
    CSV.foreach(‘path/to/csv’) do |row|
    User.create(name: row[0], email: row[1])

    You can run this on a local copy of your Heroku PG database. If there is already data in it then you’ll want to pull down a copy before running the rake task.

    heroku pg:pull HEROKU_DATABASE_NAME local_db

    Then you could run this from the command line in your local db like so:

    rake import_from_csv

    And finally, push a copy of your local database into the Heroku one like this:

    heroku pg:push local_db HEROKU_DATABASE_NAME


Leave a Comment