Change database from sqlite postgres

System Information
  • 4.0.0:
  • Ubuntu:
  • sqlite:
  • 14:
  • ****:
  • ****:

I have create a strapi with slite as a database. Now i want to change the database to postgres. Using the same model and content-type that i have created. How can i do this?


change the ./config/database.js file

module.exports = ({ env }) => ({
  connection: {
    client: 'postgres',
    connection: {
      host: env('DATABASE_HOST', 'localhost'),
      port:'DATABASE_PORT', 5432),
      database: env('DATABASE_NAME', 'database_name'),
      user: env('DATABASE_USERNAME', 'user'),
      password: env('DATABASE_PASSWORD', 'password'),
      ssl: env.bool('DATABASE_SSL', false),

Then restart the server.
You may need to install pg or create the database manually.

I tried to change the ./config/database.js file.
But after restart strapi, I lost all my previous content-type.
What I need to do to save my work when I change a database?