mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 02:56:10 +00:00
2e3762afe1
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.
15 lines
656 B
TypeScript
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());
|