This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/api/src/config/database.ts

39 lines
958 B
TypeScript
Raw Normal View History

2024-08-09 23:51:41 +02:00
import env from "#start/env.js"
import app from "@adonisjs/core/services/app"
2024-08-09 23:51:41 +02:00
import { defineConfig } from "@adonisjs/lucid"
const databaseConfig = defineConfig({
prettyPrintDebugQueries: !app.inProduction,
2024-08-12 14:21:34 +02:00
connection: app.inTest ? "sqlite" : "postgres",
2024-08-09 23:51:41 +02:00
connections: {
postgres: {
debug: app.inDev,
client: "pg",
2024-08-09 23:51:41 +02:00
connection: {
host: env.get("DATABASE_HOST"),
port: env.get("DATABASE_PORT"),
user: env.get("DATABASE_USER"),
password: env.get("DATABASE_PASSWORD"),
database: env.get("DATABASE_NAME"),
},
migrations: {
naturalSort: true,
paths: ["database/migrations"],
},
},
2024-08-12 14:21:34 +02:00
sqlite: {
client: "better-sqlite3",
connection: {
filename: ":memory:",
},
useNullAsDefault: true,
migrations: {
naturalSort: true,
paths: ["database/migrations"],
},
},
2024-08-09 23:51:41 +02:00
},
})
export default databaseConfig