Thanks to visit codestin.com
Credit goes to fixed.docs.upsun.com

Platform.sh is now Upsun. Click here to learn more
Upsun Fixed User Documentation

Configure SQLite for Strapi on Upsun Fixed

Try Upsun for 15 days
After that, enjoy the same game-changing Upsun features for less with the First Project Incentive!¹ A monthly $19 perk!
Activate your 15-day trial
¹Terms and conditions apply. Only for Flexible Resource projects.

Strapi uses SQLite database by default when it’s run on a local machine. When you create a new Strapi project, you can use SQLite or a custom database installation (PostgreSQL, MongoDB, or MySQL). Since Strapi uses SQLite by default, you don’t need much configuration, just follow these steps:

  1. In your Strapi project, install the config reader.

    npm install platformsh-config
    
    # or for Yarn
    yarn add platformsh-config
  2. Create a new Strapi project and select Quickstart as the installation type. This automatically configures Strapi for SQLite

    npx create-strapi-app <APP_NAME>
  3. In the config folder, locate the database.js file, and replace its content with the following:

    const config = require("platformsh-config").config();
    const path = require("path");
    
    
    let dbRelationship = "pg";
    
    // Strapi default sqlite settings.
    let pool = {};
    let connection = {
    connection: {
    client: 'sqlite',
    connection: {
    filename: path.join(\_\_dirname, '..', process.env.DATABASE_FILENAME || '.tmp/data.db'),
    },
    useNullAsDefault: true,
      },
    };
    
    if (config.isValidPlatform() && !config.inBuild()) {
    // Upsun Fixed database configuration.
    try {
    const credentials = config.credentials(dbRelationship);
    console.log(`Using Upsun Fixed configuration with relationship ${dbRelationship}.`);
    
        pool = {
          min: 0,
          max: 10,
          acquireTimeoutMillis: 600000,
          createTimeoutMillis: 30000,
          idleTimeoutMillis: 20000,
          reapIntervalMillis: 20000,
          createRetryIntervalMillis: 200,
        };
    
        connection = {
          connection: {
            client: "postgres",
            connection: {
              host: credentials.ip,
              port: credentials.port,
              database: credentials.path,
              user: credentials.username,
              password: credentials.password,
              ssl: false
            },
            debug: false,
            pool
          },
        };
    
    }
    catch (e) {
    // Do nothing if 'pg' relationship isn't found.
    // Database configuration falls back on the SQLite defaults.
      }
    } else {
    if (config.isValidPlatform()) {
    // Build hook configuration message.
    console.log('Using default configuration during Upsun Fixed build hook until relationships are available.');
    } else {
    // Strapi default local configuration.
    console.log('Not in an Upsun Fixed Environment. Using default local sqlite configuration.');
     }
    }
    
    // strapi-api/config/database.js
    module.exports = ({ env }) => ( connection );

This setting deploys your Strapi application with an SQLite database.