const Sequelize = require("sequelize"); const pkg = require("../../package.json"); const databaseName = pkg.name + (process.env.NODE_ENV === "test" ? "-test" : ""); const createDB = () => { const db = new Sequelize( process.env.DATABASE_URL || `postgres://localhost:5432/${databaseName}`, { logging: false } ); return db; }; const db = createDB(); module.exports = db;