0

I have an sqlite3 database with data I want to load into my Heroku app's postgres db.

What's the best way to do this?

I was going to try exporting the records (it's a single table) to a yaml file and then uploading that file to heroku and initializing new records from it, but I ran into encoding issues. Those problems aside, is that a good approach? What's a better way of solving that problem?

0

1 Answer 1

2

A good way to transfer data to a different type of database is to use the yaml_db gem. After adding it to your Gemfile and running bundle, you can then extract the data locally using:

rake db:data:dump

This will produce a db/data.yml file. Check this into Git, push to Heroku, then run:

heroku run console
rake db:data:load

That should do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.