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:
Maurice
2026-11-17 21:27:41 +01:00
parent 8179d7d707
commit 9eeb59997e
5 changed files with 66 additions and 16 deletions
+5 -4
View File
@@ -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