MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / initORMSqlite

Function initORMSqlite

tests/bootstrap.ts:319–339  ·  view source on GitHub ↗
(type: 'sqlite' | 'libsql' | 'node-sqlite' = 'sqlite')

Source from the content-addressed store, hash-verified

317}
318
319export async function initORMSqlite<D extends AbstractSqlDriver>(type: 'sqlite' | 'libsql' | 'node-sqlite' = 'sqlite') {
320 const orm = await MikroORM.init<D>({
321 entities: ['entities-schema', '!**/User4.ts'],
322 dbName: ':memory:',
323 baseDir: BASE_DIR,
324 driver: PLATFORMS[type] as any,
325 debug: ['query'],
326 forceUndefined: true,
327 ignoreUndefinedInQuery: true,
328 logger: i => i,
329 loggerFactory: SimpleLogger.create,
330 migrations: { path: BASE_DIR + '/../temp/migrations-3', snapshot: false },
331 extensions: [Migrator, SeedManager, EntityGenerator],
332 ...(type === 'node-sqlite' ? { driverOptions: new NodeSqliteDialect(':memory:') } : {}),
333 });
334 const buf = await readFile(import.meta.dirname + '/sqlite-schema.sql');
335 await orm.em.getConnection().executeDump(buf.toString());
336 await orm.schema.update();
337
338 return orm;
339}
340
341export * from './helpers.js';

Calls 5

readFileFunction · 0.85
getConnectionMethod · 0.65
updateMethod · 0.65
executeDumpMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected