Skip to content

Commit

Permalink
chore: bump version + improve v4 migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Aug 9, 2020
1 parent 7e21bb8 commit f0d6ef0
Show file tree
Hide file tree
Showing 17 changed files with 458 additions and 374 deletions.
51 changes: 49 additions & 2 deletions docs/docs/upgrading-v3-to-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,58 @@ Support for older TypeScript versions was dropped.

## Monorepo

TODO multiple packages
The ORM has been split into several packages. In v4 one needs to require
`@mikro-orm/core` and a driver package, e.g. `@mikro-orm/mysql`. This driver
package already contains the `mysql2` dependency, so you can remove that from
your `package.json`.

- `@mikro-orm/core`
- `@mikro-orm/reflection` - `TsMorphMetadataProvider`
- `@mikro-orm/cli` - CLI support, requires entity-generator, migrator and knex
- `@mikro-orm/knex` - SQL support
- `@mikro-orm/entity-generator`
- `@mikro-orm/migrations`
- `@mikro-orm/mysql`
- `@mikro-orm/mariadb`
- `@mikro-orm/mysql-base` - Common implementation for mysql and mariadb (internal)
- `@mikro-orm/sqlite`
- `@mikro-orm/postgresql`
- `@mikro-orm/mongodb`

> For easier transition, meta package mikro-orm is still present,
> reexporting core, reflection, migrations, entity-generator and
> cli packages.
## SqlEntityManager and MongoEntityManager

TODO QB getter, knex getter, aggregate...
In v4 the `core` package, where `EntityManager` and `EntityRepository` are
defined, is not dependent on knex, and therefore it cannot have a method
returning a `QueryBuilder`. You need to import the SQL flavour of the EM
from the driver package to access the `createQueryBuilder()` method.

> The SQL flavour of EM is actually called `SqlEntityManager`, it is exported both under
> this name and under `EntityManager` alias, so you can just change the
> location from where you import.
```typescript
import { EntityManager } from '@mikro-orm/mysql'; // or any other SQL driver package

const em: EntityManager;
const qb = await em.createQueryBuilder(...);
```

Same applies for the `aggregate()` method in mongo driver:

```typescript
import { EntityManager } from '@mikro-orm/mongodb';

const em: EntityManager;
const ret = await em.aggregate(...);
```

> The mongo flavour of EM is actually called `MongoEntityManager`, it is exported both under
> this name and under `EntityManager` alias, so you can just change the
> location from where you import.
## Different default `pivotTable`

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages": ["packages/*"],
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"command": {
"version": {
"conventionalCommits": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"workspaces": [
"packages/*"
],
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/cli",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -50,10 +50,10 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4",
"@mikro-orm/knex": "^4.0.0-alpha.4",
"@mikro-orm/migrations": "^4.0.0-alpha.4",
"@mikro-orm/entity-generator": "^4.0.0-alpha.4",
"@mikro-orm/core": "^4.0.0-alpha.5",
"@mikro-orm/knex": "^4.0.0-alpha.5",
"@mikro-orm/migrations": "^4.0.0-alpha.5",
"@mikro-orm/entity-generator": "^4.0.0-alpha.5",
"chalk": "^4.1.0",
"cli-highlight": "^2.1.4",
"cli-table3": "^0.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/core",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions packages/entity-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/entity-generator",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,14 +47,14 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/knex": "^4.0.0-alpha.4",
"@mikro-orm/knex": "^4.0.0-alpha.5",
"fs-extra": "^9.0.1",
"ts-morph": "^7.1.2"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
6 changes: 3 additions & 3 deletions packages/knex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/knex",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -51,9 +51,9 @@
"knex": "^0.21.1"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
8 changes: 4 additions & 4 deletions packages/mariadb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/mariadb",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,13 +47,13 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/mysql-base": "^4.0.0-alpha.4",
"@mikro-orm/mysql-base": "^4.0.0-alpha.5",
"mariadb": "^2.4.0"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
8 changes: 4 additions & 4 deletions packages/migrations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/migrations",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,15 +47,15 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/knex": "^4.0.0-alpha.4",
"@mikro-orm/knex": "^4.0.0-alpha.5",
"fs-extra": "^9.0.1",
"ts-morph": "^7.1.2",
"umzug": "^2.3.0"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
12 changes: 6 additions & 6 deletions packages/mikro-orm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mikro-orm",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,10 +47,10 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4",
"@mikro-orm/cli": "^4.0.0-alpha.4",
"@mikro-orm/entity-generator": "^4.0.0-alpha.4",
"@mikro-orm/migrations": "^4.0.0-alpha.4",
"@mikro-orm/reflection": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5",
"@mikro-orm/cli": "^4.0.0-alpha.5",
"@mikro-orm/entity-generator": "^4.0.0-alpha.5",
"@mikro-orm/migrations": "^4.0.0-alpha.5",
"@mikro-orm/reflection": "^4.0.0-alpha.5"
}
}
6 changes: 3 additions & 3 deletions packages/mongodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/mongodb",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -50,9 +50,9 @@
"mongodb": "^3.5.9"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
8 changes: 4 additions & 4 deletions packages/mysql-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/mysql-base",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,12 +47,12 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/knex": "^4.0.0-alpha.4"
"@mikro-orm/knex": "^4.0.0-alpha.5"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
8 changes: 4 additions & 4 deletions packages/mysql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/mysql",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,13 +47,13 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/mysql-base": "^4.0.0-alpha.4",
"@mikro-orm/mysql-base": "^4.0.0-alpha.5",
"mysql2": "^2.1.0"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
8 changes: 4 additions & 4 deletions packages/postgresql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/postgresql",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,13 +47,13 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/knex": "^4.0.0-alpha.4",
"@mikro-orm/knex": "^4.0.0-alpha.5",
"pg": "^8.2.1"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
6 changes: 3 additions & 3 deletions packages/reflection/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/reflection",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -51,9 +51,9 @@
"ts-morph": "^7.1.2"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}
8 changes: 4 additions & 4 deletions packages/sqlite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mikro-orm/sqlite",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down Expand Up @@ -47,14 +47,14 @@
"access": "public"
},
"dependencies": {
"@mikro-orm/knex": "^4.0.0-alpha.4",
"@mikro-orm/knex": "^4.0.0-alpha.5",
"fs-extra": "^9.0.1",
"sqlite3": "^4.2.0"
},
"devDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
},
"peerDependencies": {
"@mikro-orm/core": "^4.0.0-alpha.4"
"@mikro-orm/core": "^4.0.0-alpha.5"
}
}

0 comments on commit f0d6ef0

Please sign in to comment.