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

Function initORMOracleDb

tests/bootstrap.ts:281–317  ·  view source on GitHub ↗
(
  dbName = 'mikro_orm_test_sg',
  options?: { schema?: 'refresh' | 'update' | 'none' },
)

Source from the content-addressed store, hash-verified

279}
280
281export async function initORMOracleDb(
282 dbName = 'mikro_orm_test_sg',
283 options?: { schema?: 'refresh' | 'update' | 'none' },
284) {
285 const orm = await MikroORM.init({
286 entities: [Author2, Address2, Book2, BookTag2, Publisher2, Test2, FooBar2, FooBaz2, FooParam2, Configuration2],
287 dbName,
288 baseDir: BASE_DIR,
289 driver: OracleDriver,
290 password: 'oracle123',
291 schemaGenerator: { managementDbName: 'system', tableSpace: 'mikro_orm' },
292 debug: ['query', 'query-params'],
293 autoJoinOneToOneOwner: false,
294 logger: i => i,
295 metadataProvider: ReflectMetadataProvider,
296 migrations: { path: BASE_DIR + '/../temp/migrations', snapshot: false },
297 forceEntityConstructor: [FooBar2],
298 subscribers: [Test2Subscriber],
299 extensions: [Migrator, SeedManager, EntityGenerator],
300 });
301
302 const schemaMode = options?.schema ?? 'refresh';
303
304 if (schemaMode === 'refresh') {
305 await orm.schema.refresh();
306 } else if (schemaMode === 'update') {
307 await orm.schema.update();
308 await orm.schema.clear();
309 }
310
311 Author2Subscriber.log.length = 0;
312 Test2Subscriber.log.length = 0;
313 EverythingSubscriber.log.length = 0;
314 FlushSubscriber.log.length = 0;
315
316 return orm;
317}
318
319export async function initORMSqlite<D extends AbstractSqlDriver>(type: 'sqlite' | 'libsql' | 'node-sqlite' = 'sqlite') {
320 const orm = await MikroORM.init<D>({

Calls 4

initMethod · 0.65
refreshMethod · 0.65
updateMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected