Linden Crandall 5075f5c5d8
Some checks are pending
Automatisch Backend Tests / test (push) Waiting to run
Automatisch CI / linter (push) Waiting to run
Automatisch CI / start-backend-server (push) Waiting to run
Automatisch CI / start-backend-worker (push) Waiting to run
Automatisch CI / build-web (push) Waiting to run
Automatisch UI Tests / test (push) Waiting to run
commit upstream files
2025-02-06 04:14:18 +09:00

34 lines
954 B
JavaScript

import { knexSnakeCaseMappers } from 'objection';
import appConfig from './src/config/app.js';
import path, { join } from 'path';
import { fileURLToPath } from 'url';
const fileExtension = 'js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const knexConfig = {
client: 'pg',
connection: {
host: appConfig.postgresHost,
port: appConfig.postgresPort,
user: appConfig.postgresUsername,
password: appConfig.postgresPassword,
database: appConfig.postgresDatabase,
ssl: appConfig.postgresEnableSsl,
},
asyncStackTraces: appConfig.isDev,
searchPath: [appConfig.postgresSchema],
pool: { min: 0, max: 20 },
migrations: {
directory: join(__dirname, '/src/db/migrations'),
extension: fileExtension,
loadExtensions: [`.${fileExtension}`],
},
seeds: {
directory: join(__dirname, '/src/db/seeds'),
},
...(appConfig.isTest ? knexSnakeCaseMappers() : {}),
};
export default knexConfig;