- Strapi works locally if im running sqlite in the database.js but not if I'm running postgres / I've found online that I can specify that
npm run develop
uses sqlite, and production should use postgres.
For REF - I found this answer here: https://github.com/strapi/strapi/discussions/6832
Can anyone show me how to set this up as I am really finding it hard to read the docus for this issue.
Currently in the file structure:
config/database.js
I have these two set ups (for local and heroku) - I comment out the postgres
set up for heroku to work locally
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'sqlite',
filename: env('DATABASE_FILENAME', '.tmp/data.db'),
},
options: {
useNullAsDefault: true,
},
},
},
});
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'postgres',
host: env('DATABASE_HOST', '127.0.0.1'),
port: env.int('DATABASE_PORT', 27017),
database: env('DATABASE_NAME', 'strapi'),
username: env('DATABASE_USERNAME', ''),
password: env('DATABASE_PASSWORD', ''),
},
options: {
ssl: false,
},
},
},
});
- When I pushed my strapi project to Heroku the correct structure is there i.e. names of articles (SHOWN IN THE BELOW IMAGE) - but none of the content is there: i.e. posts, images etc
What I imagine is happening is because the local strapi has been built using sqlite and heroku required me to use postgres as a database, the databases are not the same so the data is not being read correctly?
(I could be wrong about that....)
In this case: how do you move your local dev (recommended quick start set up) to your production site?
Do you npm run build? and then host strapi on your normal front end site?
is there a way to move the data from one database to another?
Sorry for asking many small questions here - I might have missed a concept which ties it all together.
Thanks in advance for any help, Wally