import env from "#start/env.js"
import app from "@adonisjs/core/services/app"
import { defineConfig } from "@adonisjs/lucid"
const databaseConfig = defineConfig({
prettyPrintDebugQueries: !app.inProduction,
connection: app.inTest ? "sqlite" : "postgres",
connections: {
postgres: {
debug: app.inDev,
client: "pg",
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"],
sqlite: {
client: "better-sqlite3",
filename: ":memory:",
useNullAsDefault: true,
})
export default databaseConfig