10

I've got a local strapi set up with sqlite. I didn't think ahead, sadly that I would need use postgres to deploy to Heroku later.

After struggling to deploy with the project using sqlite, I decided to create a new project using postgres and successfully deployed it to Heroku. Now, in the local project, I've already setup content types, pages and everything. I was wondering, instead of having to recreate what I have done locally, how do I copy what I've done to the new project on Heroku including the database (sqlite --> postgres).

Has anyone done this before or maybe could point me to the right direction?

thank you in advance!

Tanpo
  • 233
  • 3
  • 18

2 Answers2

7

According to this:

https://github.com/strapi/strapi/issues/205#issuecomment-490813115

Database migration (content types and relations) is no longer an issue, but moving existing data entries from one database to another is.

To change database provider, I suppose you just need to edit config/environments/**/database.json according to Postgres setup.

hp10
  • 602
  • 6
  • 11
4

Faced same issue, my solution is to use new project to generate a core for PostgreSQL and then run your existing code base on freshly created PostgreSQL:

  1. npx create-strapi-app my-project and then choose custom -> PostgreSQL (Link)
  2. When manually create a collections that are exists in SQLite, without fields
  3. Run your old codebase with new database config which point on a PostgreSQL (that will create fields that you have in your data models)

Require a little bit of manual work, but works for me. Good luck!