Files
TREK/server/src/mikro-orm.config.ts
T
Maurice 724c88c201 style: format server and shared with prettier
A mechanical prettier --write over server/src, server/tests, server/scripts
and shared/src with the workspaces' .prettierrc; nothing but layout and
import order changes, and every file keeps the same set of imports. shared
is formatted throughout and its format baseline is empty. The server
baseline keeps the 35 files that Prettier would grow past their lint:size
limit (they need a split first, which is not a formatting change), and the
generated entity files stay as their generator writes them.
2026-10-10 21:23:37 +02:00

31 lines
1.1 KiB
TypeScript

import { resolveDbPath } from './db/db-path';
import { ALL_ENTITIES } from './db/entities';
import { SharedSqliteDriver } from './db/orm-driver';
import { Migrator } from '@mikro-orm/migrations';
import { SeedManager } from '@mikro-orm/seeder';
import { defineConfig } from '@mikro-orm/sqlite';
export default defineConfig({
entities: ALL_ENTITIES,
extensions: [Migrator, SeedManager],
// Reuses the connection db/database.ts owns rather than opening a second one.
// See orm-driver.ts — with `:memory:` in tests, a second connection would be a
// second, empty database.
driver: SharedSqliteDriver,
migrations: {
path: 'dist/db/migrations',
pathTs: 'src/db/migrations',
snapshot: false,
},
seeder: {
path: 'dist/db/seeders',
pathTs: 'src/db/seeders',
defaultSeeder: 'DatabaseSeeder',
},
// Same resolution database.ts uses: `:memory:` under test, TREK_DB_FILE when
// set, else data/travel.db. The driver above ignores it for the connection
// itself, but the CLI and the migrator's logging still read it, and naming a
// different file here than the one actually open is a trap.
dbName: resolveDbPath(),
});