Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.4 #165

Merged
merged 10 commits into from
Jan 13, 2025
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.13.0
20 changes: 8 additions & 12 deletions mikro-orm.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
// @ts-nocheck
import 'reflect-metadata'
import 'dotenv/config'

import { Options } from '@mikro-orm/core'
import process from 'node:process'

import * as entities from '@/entities'
import { env } from '@/env'
import { PluginsManager } from '@/services'
import { resolveDependency } from '@/utils/functions'
import { DatabaseDriver, defineConfig, Options } from '@mikro-orm/core'

import { mikroORMConfig } from './src/configs/database'

export default async () => {
const pluginsManager = await resolveDependency(PluginsManager)
await pluginsManager.loadPlugins()

return {
...mikroORMConfig[env.NODE_ENV || 'development'] as Options<DatabaseDriver>,
entities: [...Object.values(entities), ...pluginsManager.getEntities()],
}
return defineConfig({
...mikroORMConfig[process.env.NODE_ENV || 'development'] as Options<DatabaseDriver>,
entities: [`src/entities/*.{ts,js}`, `src/plugins/*/entities/*.{ts,js}`],
})
}
Loading
Loading