New collections disappearing after I restart the container

Hi, I deployed a Strapi instance with PostGres. Everything is working well and the new collections I create are getting saved in the DB. However when I restart the Strapi instance all the new collections I create a being removed from the DB.

My database.js file:

`const path = require(“path”);

module.exports = ({ env }) => {
const client = env(“DATABASE_CLIENT”, “postgres”);
console.log(“db client =>”, client);
const connections = {
postgres: {
connection: {
connectionString: env(“DATABASE_URL”),
host: env(“DATABASE_HOST”, “localhost”),
port: env.int(“DATABASE_PORT”, 5432),
database: env(“DATABASE_NAME”, “strapi”),
user: env(“DATABASE_USERNAME”, “postgres”),
password: env(“DATABASE_PASSWORD”, “35ePh*Cr$2RATro_Obre”),
ssl: env.bool(“DATABASE_SSL”, false) && {
key: env(“DATABASE_SSL_KEY”, undefined),
cert: env(“DATABASE_SSL_CERT”, undefined),
ca: env(“DATABASE_SSL_CA”, undefined),
capath: env(“DATABASE_SSL_CAPATH”, undefined),
cipher: env(“DATABASE_SSL_CIPHER”, undefined),
rejectUnauthorized: env.bool(
“DATABASE_SSL_REJECT_UNAUTHORIZED”,
true
),
},
// schema: env(“DATABASE_SCHEMA”, “public”),
},
pool: {
min: env.int(“DATABASE_POOL_MIN”, 2),
max: env.int(“DATABASE_POOL_MAX”, 10),
},
},
sqlite: {
connection: {
filename: path.join(__dirname, “…”, env(“bo”, “.tmp/data.db”)),
},
useNullAsDefault: true,
},
};

return {
connection: {
client,
…connections[client],
acquireConnectionTimeout: env.int(“DATABASE_CONNECTION_TIMEOUT”, 60000),
},
settings: {
runMigrations: false,
forceMigration: false,
},
};
};
`

This topic has been created from a Discord post (1302202254853668945) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

If your database engine with its db files all sit inside your container, those db files get deleted on every shutdown of your container.