(
contextName?: string,
configPaths?: string[],
opts: Partial<Options<D>> = {},
)
| 84 | } |
| 85 | |
| 86 | static async getORM<D extends IDatabaseDriver = IDatabaseDriver>( |
| 87 | contextName?: string, |
| 88 | configPaths?: string[], |
| 89 | opts: Partial<Options<D>> = {}, |
| 90 | ): Promise<MikroORM<D>> { |
| 91 | const options = await this.getConfiguration<D>(contextName, configPaths, opts); |
| 92 | const settings = this.getSettings(); |
| 93 | options.set('allowGlobalContext', true); |
| 94 | options.set('debug', !!settings.verbose); |
| 95 | options.getLogger().setDebugMode(!!settings.verbose); |
| 96 | |
| 97 | if (settings.preferTs !== false) { |
| 98 | options.set('preferTs', true); |
| 99 | } |
| 100 | |
| 101 | // The only times when we don't care to have a warning about no entities is also the time when we ignore entities. |
| 102 | if (opts.discovery?.warnWhenNoEntities === false) { |
| 103 | options.set('entities', []); |
| 104 | options.set('entitiesTs', []); |
| 105 | } |
| 106 | |
| 107 | return MikroORM.init(options.getAll()); |
| 108 | } |
| 109 | |
| 110 | static async isDBConnected(config: Configuration, reason?: false): Promise<boolean>; |
| 111 | static async isDBConnected(config: Configuration, reason: true): Promise<true | string>; |
no test coverage detected