Finlay Weber
Finlay Weber

Reputation: 4163

How to use sqlite on Heroku

I will like to deploy an app that uses sqlite to Heroku. Googling for how to do this, I come across the official documentation of sqlite on hereku here

And the amazing thing is that, the documentation seems to be suggesting you should not use sqlite on heroku and then went further to tell you how to use Postgres instead!!!

Is it really impossible to use sqlite on heroku and have your data not transient?

Upvotes: 2

Views: 5371

Answers (1)

Gitau Harrison
Gitau Harrison

Reputation: 3517

Heroku has a database offering of its own, based on the Postgres database so it is necessary to switch so as to avoid the file-based SQlite. To connect to a Heroku database, you will need to use the Heroku CLI. That is the recommendation, as you have noted.

You can run heroku addons:add <your database choice, say the free tier one for example>. It is as simple as that.

If you try to run heroku config:get DATABASE_URL you will notice that a postgres://<> (now postgresql) has been created for you.

Upvotes: 1

Related Questions