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

feat(core): remove static require calls #3814

Merged
merged 1 commit into from Dec 3, 2022
Merged

feat(core): remove static require calls #3814

merged 1 commit into from Dec 3, 2022

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Dec 3, 2022

There were some places where we did a static require() call, e.g. when loading the driver implementation based on the type option. Those places were problematic for bundlers like webpack, as well as new school build systems like vite.

The type option is removed in favour of driver exports

Instead of specifying the type we now have several options:

  1. use defineConfig() helper imported from the driver package to create your ORM config:
    import { defineConfig } from '@mikro-orm/mysql';
    
    export default defineConfig({ ... });
  2. use MikroORM.init() on class imported from the driver package:
    import { MikroORM } from '@mikro-orm/mysql';
    
    const orm = await MikroORM.init({ ... });
  3. specify the driver option:
    import { MySqlDriver } from '@mikro-orm/mysql';
    
    export default { driver: MySqlDriver, ... };

The MIKRO_ORM_TYPE is still supported, but no longer does a static require of the driver class. Its usage is rather discouraged and it might be removed in future versions too.

ORM extensions

Similarly, we had to get rid of the require() calls for extensions like Migrator, EntityGenerator and Seeder. Those need to be registered as extensions in your ORM config. SchemaGenerator extension is registered automatically.

This is required only for the shortcuts available on MikroORM object, e.g. orm.migrator.up(), alternatively you can instantiate the Migrator yourself explicitly.

import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});

Closes #3743

@lgtm-com
Copy link

lgtm-com bot commented Dec 3, 2022

This pull request fixes 2 alerts when merging 0ef45f0 into be8f205 - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2022

Codecov Report

Base: 99.94% // Head: 99.90% // Decreases project coverage by -0.04% ⚠️

Coverage data is based on head (76a0e79) compared to base (be8f205).
Patch coverage: 92.30% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #3814      +/-   ##
==========================================
- Coverage   99.94%   99.90%   -0.05%     
==========================================
  Files         214      216       +2     
  Lines       13461    13429      -32     
  Branches     3130     3128       -2     
==========================================
- Hits        13454    13416      -38     
- Misses          7       13       +6     
Impacted Files Coverage Δ
...ckages/cli/src/commands/MigrationCommandFactory.ts 100.00% <ø> (ø)
packages/core/src/drivers/DatabaseDriver.ts 100.00% <ø> (ø)
packages/core/src/drivers/IDatabaseDriver.ts 100.00% <ø> (ø)
packages/core/src/platforms/Platform.ts 98.64% <ø> (-0.91%) ⬇️
packages/core/src/typings.ts 100.00% <ø> (ø)
packages/knex/src/AbstractSqlPlatform.ts 98.11% <ø> (-0.20%) ⬇️
packages/mongodb/src/MongoDriver.ts 100.00% <ø> (ø)
packages/mongodb/src/MongoPlatform.ts 97.87% <ø> (-2.13%) ⬇️
packages/core/src/MikroORM.ts 98.01% <80.00%> (-1.99%) ⬇️
packages/core/src/utils/Configuration.ts 99.25% <93.33%> (-0.75%) ⬇️
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@B4nan B4nan changed the title chore: configure canary builds for v6 feat(core): remove static require calls Dec 3, 2022
@lgtm-com
Copy link

lgtm-com bot commented Dec 3, 2022

This pull request fixes 2 alerts when merging 76a0e79 into be8f205 - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

There were some places where we did a static `require()` call, e.g. when loading the driver implementation based on the `type` option. Those places were problematic for bundlers like webpack, as well as new school build systems like vite.

### The `type` option is removed in favour of driver exports

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
2. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
3. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default {
     driver: MySqlDriver,
     ...
   };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static require of the driver class. Its usage is rather discouraged and it might be removed in future versions too.

### ORM extensions

Similarly, we had to get rid of the `require()` calls for extensions like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be registered as extensions in your ORM config. `SchemaGenerator` extension is registered automatically.

> This is required only for the shortcuts available on `MikroORM` object, e.g. `orm.migrator.up()`, alternatively you can instantiate the `Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

## `MikroORM.init()` no longer accepts a `Configuration` instance

The options always needs to be plain JS object now. This was always only an internal way, partially useful in tests, never meant to be a user API (while many people since the infamous Ben Awad video mistakenly complicated their typings with it).
@B4nan B4nan merged commit ec4c8c4 into v6 Dec 3, 2022
@B4nan B4nan deleted the remove-static-require branch December 3, 2022 11:13
B4nan added a commit that referenced this pull request Dec 3, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

### The `type` option is removed in favour of driver exports

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

### ORM extensions

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
@lgtm-com
Copy link

lgtm-com bot commented Dec 3, 2022

This pull request fixes 2 alerts when merging ae30889 into 59f2e7f - view on LGTM.com

fixed alerts:

  • 2 for Unused variable, import, function or class

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

B4nan added a commit that referenced this pull request Dec 3, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

### The `type` option is removed in favour of driver exports

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

### ORM extensions

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Dec 5, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Dec 6, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Dec 8, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Dec 12, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Dec 18, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Dec 27, 2022
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Jan 2, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Jan 4, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Jan 8, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
@B4nan B4nan restored the remove-static-require branch January 10, 2023 19:11
@B4nan B4nan deleted the remove-static-require branch January 10, 2023 19:17
B4nan added a commit that referenced this pull request Jan 13, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Jan 26, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Feb 5, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Feb 12, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Feb 17, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Feb 17, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Feb 26, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Mar 19, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Apr 6, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Apr 10, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Apr 12, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Apr 26, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request May 14, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request May 14, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request May 24, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request May 26, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Jun 11, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Sep 10, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Sep 20, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Sep 24, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Sep 30, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
@B4nan B4nan mentioned this pull request Sep 30, 2023
22 tasks
B4nan added a commit that referenced this pull request Oct 2, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Oct 17, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Oct 21, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Oct 25, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Nov 2, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Nov 5, 2023
There were some places where we did a static `require()` call, e.g. when
loading the driver implementation based on the `type` option. Those
places were problematic for bundlers like webpack, as well as new school
build systems like vite.

Instead of specifying the `type` we now have several options:

1. use `defineConfig()` helper imported from the driver package to
create your ORM config:
   ```ts title='mikro-orm.config.ts'
   import { defineConfig } from '@mikro-orm/mysql';

   export default defineConfig({ ... });
   ```
3. use `MikroORM.init()` on class imported from the driver package:
   ```ts title='app.ts'
   import { MikroORM } from '@mikro-orm/mysql';

   const orm = await MikroORM.init({ ... });
   ```
5. specify the `driver` option:
   ```ts title='mikro-orm.config.ts'
   import { MySqlDriver } from '@mikro-orm/mysql';

   export default { driver: MySqlDriver, ... };
   ```

> The `MIKRO_ORM_TYPE` is still supported, but no longer does a static
require of the driver class. Its usage is rather discouraged and it
might be removed in future versions too.

Similarly, we had to get rid of the `require()` calls for extensions
like `Migrator`, `EntityGenerator` and `Seeder`. Those need to be
registered as extensions in your ORM config. `SchemaGenerator` extension
is registered automatically.

> This is required only for the shortcuts available on `MikroORM`
object, e.g. `orm.migrator.up()`, alternatively you can instantiate the
`Migrator` yourself explicitly.

```ts title='mikro-orm.config.ts'
import { defineConfig } from '@mikro-orm/mysql';
import { Migrator } from '@mikro-orm/migrations';
import { EntityGenerator } from '@mikro-orm/entity-generator';
import { SeedManager } from '@mikro-orm/seeder';

export default defineConfig({
  dbName: 'test',
  extensions: [Migrator, EntityGenerator, SeedManager], // those would have a static `register` method
});
```

Closes #3743
B4nan added a commit that referenced this pull request Nov 26, 2023
This was reintroduced on some bad merge probably, it's no longer needed after #3814.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants