mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 21:33:19 +00:00
fix(db): count every spelling of an engine check in lint:engine-dispatch
The gate matched only isSqlite(/isPostgres(, instanceof on a platform class and a comparison on a property named engine or id. A destructured engine name, the literal on the left, a switch over the engine, instanceof on a driver class and a comparison with a driver class all passed with an empty baseline, and standalone-orm.ts already held one such check. The regex now matches every one of them, the guard in standalone-orm.ts moves into the engine port as assertSqliteOrmConfig, and the advice names where a check belongs.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import mikroOrmConfig from '../mikro-orm.config';
|
||||
import { assertSqliteOrmConfig } from './engine';
|
||||
import type { AnyOrm } from './orm';
|
||||
import { SharedSqliteDriver } from './orm-driver';
|
||||
import { MikroORM as SqliteMikroORM } from '@mikro-orm/sqlite';
|
||||
|
||||
/**
|
||||
@@ -12,9 +12,10 @@ import { MikroORM as SqliteMikroORM } from '@mikro-orm/sqlite';
|
||||
* SQLite driver's, so a config that names another engine is refused.
|
||||
*/
|
||||
export function createStandaloneOrm(): Promise<AnyOrm> {
|
||||
if (mikroOrmConfig.driver !== SharedSqliteDriver) {
|
||||
throw new Error('createStandaloneOrm builds the SQLite schema snapshot; unset TREK_DB_URL to run it.');
|
||||
}
|
||||
assertSqliteOrmConfig(
|
||||
mikroOrmConfig,
|
||||
'createStandaloneOrm builds the SQLite schema snapshot; unset TREK_DB_URL to run it.',
|
||||
);
|
||||
return SqliteMikroORM.init({
|
||||
...mikroOrmConfig,
|
||||
// Entity discovery is skipped deliberately. Migrations and seeders are raw
|
||||
|
||||
Reference in New Issue
Block a user