Files
usenet-indexer/config/database.ts
T
Daan MeijerandClaude Opus 5.5 96f0ade10e Rebuild: fresh AdonisJS 7 API app on Postgres
The rebuild branch starts over (REBUILD.md): the API starter kit, with
Postgres instead of SQLite (its own database, DB_SEARCH_PATH for a
shared one in development) and the #lib alias. Phase 1's code is
imported from the current app module by module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 00:05:24 +02:00

38 lines
1.1 KiB
TypeScript

import env from '#start/env'
import app from '@adonisjs/core/services/app'
import { defineConfig } from '@adonisjs/lucid'
/**
* The rebuild's own database (REBUILD.md, decision b), on the same server
* as the current indexer's.
*/
const dbConfig = defineConfig({
connection: 'pg',
connections: {
pg: {
client: 'pg',
connection: {
host: env.get('DB_HOST'),
port: env.get('DB_PORT'),
user: env.get('DB_USER'),
password: env.get('DB_PASSWORD'),
database: env.get('DB_DATABASE'),
},
// Local development may share a database, in its own schema (DB_SEARCH_PATH=rebuild).
...(env.get('DB_SEARCH_PATH') ? { searchPath: env.get('DB_SEARCH_PATH')!.split(',') } : {}),
pool: { min: 0, max: env.get('DB_POOL_MAX', 10) },
migrations: {
naturalSort: true,
paths: ['database/migrations'],
},
schemaGeneration: {
enabled: true,
rulesPaths: ['./database/schema_rules.js'],
},
debug: app.inDev && env.get('DB_DEBUG', false),
},
},
})
export default dbConfig