1

For background, I'm trying to migrate my sqlite3 local db to a postgresql db on Heroku.

I have no problem accessing the db locally through my (Django) development server. However, when I try to push the db to Heroku, it says it can't open the file.

heroku db:push sqlite://path/to/db --confirm my-app-name

I get the following message:

Loaded Taps v0.3.23
Warning: Data in the app 'my-app-name' will be overwritten and will not be recoverable.
Failed to connect to database:
      Sequel::DatabaseConnectionError -> SQLite3::CantOpenException: could not open database: unable to open database file

Most everything I've seen on Google relates to some bugs in earlier versions of Tap. Otherwise, I'm not sure what I should do here.

I've tried following the advice of this question and others about permissions, but I have full read and write access to the file and containing folder. I'm not too experienced with permissions -- do I need to switch ownership of the db to another user?

Community
  • 1
  • 1
tchaymore
  • 3,728
  • 13
  • 55
  • 86

2 Answers2

1

If /path/to/database is an absolute path, you need to do:

heroku db:push sqlite:///path/to/db --confirm my-app-name

Note the third slash. It could also be a permissions issue, in which case you want to either change the owner to the current user, or give at least read permission to the database (644).

Jeremy Evans
  • 11,959
  • 27
  • 26
0

I would try to save the data from sqlite3 to a fixture via dumpdata and then, after switching to postgres, load it again via loaddata.

Martin
  • 4,170
  • 6
  • 30
  • 47