Files
TREK/server/src/mikro-orm.config.ts
T
Isaias Tavares 2e3762afe1 feat(db): run TREK on PostgreSQL
TREK runs on PostgreSQL when TREK_DB_URL is set, and on SQLite as before
otherwise: an engine port under src/db/engine, the dialect helpers under
src/db/dialect, a Postgres baseline for the migrations up to the cut,
pg_dump/pg_restore backups, a probe of every repository method against a
real server and a Postgres test lane in CI.
2026-11-17 23:03:33 +01:00

15 lines
656 B
TypeScript

import { buildOrmConfig, resolveEngine } from './db/engine';
/**
* The MikroORM config for the CLI and the Nest container alike: the engine
* `TREK_DB_URL` names (the SQLite file by default) and what every engine shares
* (`db/engine/index.ts`).
*
* Built at module level, not from `DATABASE_ENGINE`, because the MikroORM CLI
* loads this file without Nest. Only the engine's options come from it, and
* those are plain values with no state, so it and the container's engine agree
* on the database. The state an engine keeps (Postgres's reopen hook) exists
* only on the container's instance.
*/
export default buildOrmConfig(resolveEngine());