In my current project, I am using TypeScript with Bun + Elysia. Previously, I migrated my app from a NestJs project that was working fine with MikroORM. However, after switching to `bun`, the migrator command doesn't work as expected:
bunx --bun mikro-orm
The error message I'm encountering is:
354 | /* istanbul ignore next */
355 | if ('type' in this.options) {
356 | throw new Error('The `type` option has been removed in v6, please fill in the `driver` option instead or use `defineConfig` helper (to define your ORM config) or `MikroORM` class (to call the `init` method) exported from the driver package (e.g. `import { defineConfig } from '@mikro-orm/mysql'; export default defineConfig({ ... })`).');
357 | }
358 | if (!this.options.driver) {
359 | throw new Error('No driver specified, please fill in the `driver` option or use `defineConfig` helper (to define your ORM config) or `MikroORM` class (to call the `init` method) exported from the driver package (e.g. `import { defineConfig } from '@mikro-orm/mysql'; export defineConfig({ ... })`).');
^
error: No driver specified, please fill in the `driver` option or use `defineConfig` helper (to define your ORM config) or `MikroORM` class (to call the `init` method) exported from the driver package (e.g. `import { defineConfig } from '@mikro-orm/mysql'; export defineConfig({ ... })`).
at validateOptions (C:\Users\X\Projects\smm_est\server\node_modules\@mikro-orm\cli\node_modules\@mikro-orm\core\utils\Configuration.js:359:19)
at new Configuration (C:\Users\X\Projects\smm_est\server\node_modules\@mikro-orm\cli\node_modules\@mikro-orm\core\utils\Configuration.js:140:13)
at C:\Users\X\Projects\smm_est\server\node_modules\@mikro-orm\cli\node_modules\@mikro-orm\core\utils\ConfigurationLoader.js:38:24
error: script "orm" exited with code 1
However, I have correctly set up everything in the src/orm.ts
file like so:
// orm.ts
import { Migrator } from '@mikro-orm/migrations'
import { SeedManager } from '@mikro-orm/seeder'
import { MikroORM, ReflectMetadataProvider, SqliteDriver, defineConfig } from '@mikro-orm/sqlite'
import { User } from '#user/user.entity'
import { Role } from '#role/role.entity'
import { Ability } from '#role/ability.entity'
import { Link } from '#link/link.entity'
// Rest of the configuration...
export default orm
This ongoing issue is starting to frustrate me. I've considered making a switch to Drizzle, but with MikroORM, the migration to MySql seems more convenient.