Skip to content

Commit

Permalink
update changelog for 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Nov 29, 2019
1 parent 06a3421 commit 48945b8
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions doc/changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,41 @@

### What's new

- relatedQuery can now be used for more than just subqueries. See the examples [here](/guide/query-examples.html#relation-queries).
- Cleaner and more consistent API. A lot of methods have been renamed, removed combined and cleaned up. Most of the old methods still exist, but print a deprecation warning when first used. Some examples:

- modifiers can now take arguments and are a lot more useful. See [this recipe](https://vincit.github.io/objection.js/recipes/modifiers.html) for more info.
- `eager` -> `withGraphFetched`
- `joinEager` -> `withGraphJoined`
- removed `eagerAlgorithm` (you must explicitly use either `withGraphFetched` or `withGraphJoined`)
- merged `allowEager`, `allowInsert` and `allowUpsert` into one method `allowGraph`
- `$loadRelated` -> `$fetchGraph`
- `joinRelation` -> `joinRelated`
- `$relatedQuery` no longer mutates the receiving model instances

- `insertMissing` `upsertGraph` option now works as expected with `relate: true`: items that are not found in the database are inserted.
- New [static hook API](/guide/hooks.html#static-query-hooks). The old instance hooks are still around.

### Breaking changes
- `relatedQuery` can now be used for more than just subqueries. See the examples [here](/guide/query-examples.html#relation-queries).

See the [migration guide](/1.x/migration.md).
- modifiers can now take arguments and are a lot more useful. See [this recipe](https://vincit.github.io/objection.js/recipes/modifiers.html) for more info.

- Objection now uses the native promise instead of bluebird which means that all bluebird specific methods like `map`, `reduce`, `reflect`, `bind`, `asCallback`, `nodeify`, `return` etc. have been removed from the `QueryBuilder`.
- Objection now uses the [db-errors](https://github.com/Vincit/db-errors/issu) library by default to wrap the database errors.

- Database errors throw by objection are now wrapped using the [db-errors library](https://github.com/Vincit/db-errors). If you have code that uses the properties of the old native database errors, you can access the native error through `err.nativeError`.
- `insertMissing` `upsertGraph` option now works as expected with `relate: true`: items that are not found in the database are inserted.

- Brand new typings written from scratch with many improvements and finally a support for [custom query builders](/recipes/custom-query-builder.html#custom-query-builder)

- Only the first argument of [modify](/api/query-builder/other-methods.html#modify) query builder method is interpreted as a modifier name. Rest of the arguments are passed as arguments to the modifier. The first argument can be an array of modifier names.
- A bunch of improvements and bug fixes for `upsertGraph`, including a huge speedup in some cases due to less data fetching.

- Using `#ref` in an `insertGraph` or an `upsertGraph` now needs the [allowGraph](/api/types/#type-insertgraphoptions) option to be true.
- A brand new [fn](/api/objection/#fn) helper for calling SQL functions.

- `relate` now always returns the number of affected rows. Previously it returned the inserted pivot table row in case of `ManyToManyRelation`.
- Objection now uses native promises instead of bluebird.

- The default value for [relatedFindQueryMutates](/api/model/static-properties.html#static-relatedfindquerymutates) and [relatedInsertQueryMutates](https://vincit.github.io/objection.js/api/model/static-properties.html#static-relatedinsertquerymutates) is now false. It used to be true.
- Objection is now leaner as we dropped a bunch of dependencies like `bluebird` and `lodash`.

- `QueryBuilder.toString()` and `QueryBuilder.toSql()` have been removed. You can use `QueryBuilder.toKnexQuery().toSQL()` instead.
- In addition to all of this, a huge number of bugs has been squashed!

- TODO: Model.raw no longer returns a knex raw instance, but objection.raw.
### Breaking changes

See the [migration guide](/1.x/migration.md).

## 1.6.10

Expand Down

0 comments on commit 48945b8

Please sign in to comment.