# Changelog
# 3.1.5
# What's new
- Types: Fix generic static
this
#2533 (opens new window) - Types: Add
fromRaw
to `FromSelector regex #2628 (opens new window) - Types: Fix argument types of
onConflict()
#2635 (opens new window) - Types: Make
trx
optional forModel.transaction(trx, cb)
#2694 (opens new window)
# 3.1.4
# What's new
- Fix
upsertGraph()
$beforeUpdate()
calls on empty relates #2605 (opens new window) - Don't call
onError()
with internal exceptions #2603 (opens new window) - Remove docs and typings for nonexistent
$pick()
- Make
$omitFromJson()
+$omitFromDatabaseJson()
compatible with old$omit()
syntax
# 3.1.3
# What's new
- Revert generic constructor type change #2531 (opens new window), #2399 (opens new window)
# What's new
- Patch Validator: Prevent recursion on inner properties #2520 (opens new window)
# 3.1.2
# What's new
- Patch Validator: Prevent recursion on inner properties #2520 (opens new window)
# 3.1.1
# What's new
- Only add Ajv formats if they weren't added in user-land already #2482 (opens new window)
# 3.1.0
# What's new
- Support
$beforeUpdate()
mutations inupsertGraph()
#2233 (opens new window) - Remove deprecated
$afterGet()
hook #2477 (opens new window) - Drop support for Node v12 #2478 (opens new window)
# 3.0.5
# What's new
- Fixes #2183 (opens new window)
- Fixes #2257 (opens new window)
- Fixes #2276 (opens new window)
- Fixes #2453 (opens new window)
- Fixes #2476 (opens new window)
# 3.0.4
# What's new
- Fixes #2447 (opens new window)
# 3.0.3
# What's new
- Fixes #1673 (opens new window)
- Fixes #1957 (opens new window)
- Fixes #2105 (opens new window)
- Fixes #2132 (opens new window)
- Fixes #2251 (opens new window)
- Fixes #2262 (opens new window)
- Fixes #2271 (opens new window)
- Fixes #2277 (opens new window)
- Fixes #2308 (opens new window)
- Fixes #2311 (opens new window)
- Fixes #2311 (opens new window)
- Fixes #2311 (opens new window)
- Fixes #2332 (opens new window)
- Fixes #2337 (opens new window)
- Fixes #2372 (opens new window)
- Fixes #2379 (opens new window)
- Fixes #2383 (opens new window)
- Fixes #2399 (opens new window)
- Fixes #2404 (opens new window)
- Fixes #2405 (opens new window)
- Fixes #2408 (opens new window)
- Fixes #2409 (opens new window)
- Fixes #2423 (opens new window)
# 3.0.2
# What's new
- Fixes #1356 (opens new window)
- Fixes #1957 (opens new window)
- Fixes #2192 (opens new window)
- Fixes #2247 (opens new window)
- Fixes #2307 (opens new window)
- Fixes #2308 (opens new window)
- Fixes #2311 (opens new window)
- Fixes #2323 (opens new window)
- Fixes #2337 (opens new window)
- Fixes #2362 (opens new window)
# 3.0.1
# What's new
- Fixes #2123 (opens new window)
- Fixes #2150 (opens new window)
- Fixes #2179 (opens new window)
# 3.0.0
# What's new
- Fixes #1986 (opens new window)
- Fixes #1987 (opens new window)
- Fixes #1954 (opens new window)
- Fixes #1993 (opens new window)
- Fixes #1688 (opens new window)
- Fixes #1651 (opens new window)
- Fixes #2135 (opens new window)
- Fixes #1936 (opens new window)
- Fixes #1905 (opens new window)
- Fixes #1997 (opens new window)
- Fixes #2024 (opens new window)
# Breaking changes
See the migration guide.
# 2.2.10
# What's new
- Add
modelClass
property forValidationError
andNotFoundError
.
# 2.2.9
# What's new
- Add
noWait
query builder method.
# 2.2.8
# What's new
- Fixes #1982 (opens new window)
- Fixes #1983 (opens new window)
# 2.2.7
# What's new
QueryBuilder.castTo
can now be used to cast query results to any typescript type.
# 2.2.6
# What's new
- Fixes #1964 (opens new window)
# 2.2.5
# What's new
- Fixes #1855 (opens new window)
# 2.2.4
# What's new
- Add support for onConflict, merge and ignore knex methods.
# 2.2.2
# What's new
# 2.2.1
# What's new
- Fixes #1757 (opens new window)
- Fixes #1729 (opens new window)
# 2.2.0
# What's new
- Fixes #1770 (opens new window)
- Fixes #1699 (opens new window)
- Fixes #1703 (opens new window)
- Fixes #1675 (opens new window)
- Fixes #1708 (opens new window)
- Fixes #1743 (opens new window)
- Fixes #1731 (opens new window)
- Fixes #1761 (opens new window)
# 2.1.4
# What's new
- Fixes #1750 (opens new window)
# 2.1.3
# What's new
- Add
underscoreBetweenUppercaseLetters
option for snake case mappers. #1676 (opens new window)
# 2.1.2
# What's new
- Fix
startTransaction
typings.
# 2.1.1
# What's new
- Fixes #1489 (opens new window)
# 2.1.0
# What's new
- Fixes #1638 (opens new window)
- Fixes #1636 (opens new window)
- Fixes #1615 (opens new window)
# Changelog
# 2.0.10
# What's new
- Fixes #1630 (opens new window)
# 2.0.9
# What's new
- Fixes #1606 (opens new window)
# 2.0.8
# What's new
- Fixes #1627 (opens new window)
# 2.0.7
# What's new
- Fixes #1607 (opens new window)
# 2.0.6
# What's new
- Fixes #1603 (opens new window)
# 2.0.5
# What's new
- Fixes
upsertGraph
bug where composite keys were not selected correctly. See the fix here (opens new window).
# 2.0.4
# What's new
- New
skipFetched
option forfetchGraph
and$fetchGraph
# 2.0.3
# What's new
- Fixes #1585 (opens new window)
- Fixes #1361 (opens new window)
- Fixes #1488 (opens new window)
# 2.0.0
# What's new
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:
eager
->withGraphFetched
joinEager
->withGraphJoined
- removed
eagerAlgorithm
(you must explicitly use eitherwithGraphFetched
orwithGraphJoined
) - merged
allowEager
,allowInsert
andallowUpsert
into one methodallowGraph
$loadRelated
->$fetchGraph
joinRelation
->joinRelated
$relatedQuery
no longer mutates the receiving model instances
New static hook API. The old instance hooks are still around.
relatedQuery
can now be used for more than just subqueries. See the examples here.modifiers can now take arguments and are a lot more useful. See this recipe (opens new window) for more info.
Objection now uses the db-errors (opens new window) library by default to wrap the database errors.
insertMissing
upsertGraph
option now works as expected withrelate: 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
A bunch of improvements and bug fixes for
upsertGraph
, including a huge speedup in some cases due to less data fetching.A brand new fn helper for calling SQL functions.
Objection now uses native promises instead of bluebird.
Objection is now leaner as we dropped a bunch of dependencies like
bluebird
andlodash
.In addition to all of this, a huge number of bugs has been squashed!
# Breaking changes
See the migration guide.
# 1.6.10
- Fixes #1455 (opens new window)
# 1.6.9
- Revert fix for #1089 (opens new window). It was causing more bugs than it fixed. #1089 will be addressed in 2.0.
- Typings updates
# 1.6.8
# 1.6.7
- A bunch of regression bug fixes.
# 1.6.3
- Fixes: #1227 (opens new window)
# 1.6.2
- Add
as
method forraw
making it possible to useraw
expressions injoinEager
modifiers (as long as you give names to your raw expressions usingas
).
# 1.6.1
- Fix some very rare upsertGraph edge cases.
# 1.6.0
Add
Model.traverseAsync
andmodelInstance.$traverseAsync
methods.Fixes: #842 (opens new window) and #1205 (opens new window). This bug is about subqueries "inheriting" parent query table name and alias. This bug has been around a long time and there is a small chance that people have started accidentally or on purpose use it as a feature. If you get weird reference errors from subqueries (relation not found, table not found etc.) you may need to explicitly give an alias or use
from
in your subqueries after this update. This is a borderline breaking change, but since 2.0 is still pretty far away, I wanted to get this out faster. If I'm wrong and people are heavily depending on this bug, I'll revert the change.Fixes: #1215 (opens new window)
Fixes: #1206 (opens new window)
# 1.5.3
# What's new
- Fixes #1204 (opens new window)
# 1.5.1
# What's new
- Relations are now loaded lazily #1202 (opens new window)
relationMappings.modelClass
can now be a function that returns a model class.
# 1.5.0
# What's new
- fix #1131 (opens new window)
- fix #1114 (opens new window)
- fix #1185 (opens new window)
- fix #1109 (opens new window)
- fix #1110 (opens new window)
- add eagerObject and eagerModifiers accessors to QueryBuilder.
- complete rewrite of
insertGraph
andupsertGraph
code. The rewrite brought a bunch of small performance optimizations and makes future development easier. No breaking changes. - Chaining
returning('*')
toinsertGraph
orupsertGraph
now propagates the call to all insert, update and delete operations. - Code using objectio can now be transpilsed to ES5. No need to add babel workarounds anymore.
# 1.4.0
# What's new
- Add
modifierNotFound
hook #1120 (opens new window) - fix #1121 (opens new window)
- fix #1126 (opens new window)
# 1.3.0
# What's new
- Use
objection.raw
instead ofknex.raw
inModel.raw
. #1077 (opens new window) - Allow modifiers (namedFilters) to be used in
modifyEager
too. - Add
underscoreBeforeDigits
option for snake case converters. #1025 (opens new window) - fix #1074 (opens new window)
- Typing fixes
# 1.2.3
# What's new
# 1.2.2
# What's new
- Improve reference cycle detection in
upsertGraph
# 1.2.1
# What's new
# 1.2.0
# What's new
- fix #919 (opens new window)
- fix #964 (opens new window)
- Add
aliasFor
method to public API - Prevent bluebird warnings
- UPPER_SNAKE_CASE support for
snakeCaseMappers
andknexSnakeCaseMappers
# 1.1.10
# What's new
- Nothing! the npm release was somehow borked. This was just a rerelease of 1.1.9.
# 1.1.9
# What's new
# 1.1.8
# What's new
# 1.1.7
# What's new
# 1.1.6
# What's new
- Add typings for fetchTableMetadata, tableMetadata and onbuildknex
# 1.1.5
# What's new
- Make Model.fetchTableMetadata and Model.tableMetadata methods public. #871 (opens new window)
- Add onBuildKnex query builder hook. #807 (opens new window)
# 1.1.4
# What's new
- fix subquery bug causing incompatibility with knex 0.14.5 and sqlite3
# 1.1.3
# What's new
- fix regression in 1.1.2 (sorry about this) #869 (opens new window)
# 1.1.2
# What's new
- Add
virtuals
option fortoJSON
and$toJson
#866 (opens new window) - fix #868 (opens new window)
# 1.1.1
# What's new
- fix #865 (opens new window)
- fix bug where the static
Model.relatedQuery
didn't use the relation name as an alias for the table. This may break code if you have explicitly referenced the subquery table. #859 (opens new window)
# 1.1.0
# What's new
- Optional object notation for relation expressions.
- fix #855 (opens new window)
- fix #858 (opens new window)
# 1.0.1
# What's new
- Added public Relation.joinModelClass accessor
- Don't call
returning
on sqlite (prevents a warning message added in knex 0.14.4) - fix #844 (opens new window)
- Small documentation updates
- Small typing fixes end updates
# 1.0.0 🎉
# What's new
- The static
relatedQuery
method. - New reflection methods:
isFind
,isInsert
,isUpdate
,isDelete
,isRelate
,isUnrelate
,hasWheres
,hasSelects
,hasEager
,has
.clear
.columnNameToPropertyName
,propertyNameToColumnName
. ManyToMany
extras now work consistently in queries and filters. #760 (opens new window)
# Breaking changes
modelInstance.$query().delete().returning(something)
now returns a single instance instead of an array. #659 (opens new window)Node 6.0.0 is now the minimum. Objection will not work on node < 6.0.0.
ValidationError
overhaul. This is a big one, so read this carefully! There are three things to check when you migrate to 1.0:- The
createValidationError
andValidationError
interfaces have changed. If you have overridden thecreateValidationError
method in your project, or you create customValidationError
instances you need migrate to the interfaces. - The model validation errors (jsonSchema violations) have remained pretty much the same but there are couple of differences. Before, the
keys of
error.data
were property names even when a nested object in a graph failed a validation. Now the keys for nested validation errors are key paths likefoo.bar[2].spam
. Another tiny difference is the order of validation errors for each key inerror.data
. Let's say a propertyspam
failed for your model anderror.data.spam
contains an array of objects that describe the failures. Before, the first failed validation was the last item in the array, now it is the first item. - All
ValidationErrors
now have atype
field. Before allValidationErrors
but the model validation errors (errors like "invalid relation expression", or "cyclic model graph") had no type, and could only be identified based on the existence of some weird key inerror.data
. Theerror.data
is now removed from those errors and thetype
should be used instead. The message from the data is now stored inerror.message
.
- The
Removed deprecated methods
whereRef
,whereJsonField
andwhereJsonEquals
. Theref
helper can be used to replace thewhereRef
calls.ref
andlit
can be used to replace the removed json methods.ManyToMany
extras now work consistently in queries and filters. #760 (opens new window). This is not a breaking change per se, but can cause some queries to fail with a "ambiguous identifier" error because the join table is now joined in places where it previously wasn't. You need to explicitly specify the table for those failing columns usingTable.theColumn
syntax.
# Changes
isFindQuery
is renamed toisFind
(opens new window) and deprecated.
# 0.9.4
# What's new
- Fixed #627 (opens new window)
- Fixed #671 (opens new window)
- Fixed #672 (opens new window)
- Fixed #674 (opens new window)
# 0.9.3
# What's new
- Add beforeInsert hook for relations. #649 (opens new window) #19 (opens new window)
- Add
relatedFindQueryMutates
andrelatedInsertQueryMutates
configs as well as$setRelated
and$appendRelated
helpers. #599 (opens new window) - Fixed #648 (opens new window)
# 0.9.2
# What's new
- Fix regression:
from
fails with a subquery.
# 0.9.1
# What's new
castTo
(opens new window) method for setting the model class of query result rows.onError
(opens new window)QueryBuilder
method.knexSnakeCaseMappers
(opens new window) andsnakeCaseMappers
(opens new window) for snake_case to camelCase conversions.
# 0.9.0
# What's new
- Relations can now be defined using keys inside JSON columns. See the examples here (opens new window).
lit
(opens new window) helper function #275 (opens new window)- Fixes for
upsertGraph
(opens new window) when using composite keys. #517 (opens new window) - Added
noDelete
,noUpdate
,noInsert
,noRelate
andnoUnrelate
options forupsertGraph
. See UpsertGraphOptions docs for more info. insertGraph
now accepts an options object just likeupsertGraph
.relate
option can be used instead of#dbRef
. #586 (opens new window)
# Breaking changes
Instance update/patch with
returning
now return a single object instead of an array. #423 (opens new window)Because of the support for JSON relations the
Relation
class (opens new window) has changed a bit.
# 0.8.8
# What's new
- Typing updates: #489 (opens new window) #487 (opens new window)
- Improve
resultSize
method. #213 (opens new window) - Avoid unnecessary updates in upsertGraph #480 (opens new window)
# 0.8.7
# What's new
throwIfNotFound
now also throws when update or delete doesn't change any rows.mixin
andcompose
helpers for applying multiple plugins. #475 (opens new window) #473 (opens new window)- Typing updates #474 (opens new window) #479 (opens new window)
upsertGraph
now validates patched models correctly. #477 (opens new window)
# 0.8.6
# What's new
- Finally: the first version of
upsertGraph
method! Please open issues about bugs, WTFs and missing features. - Strip readonly virtual properties in fromJson & friends #432 (opens new window)
- Fixed #439 (opens new window)
# 0.8.5
# What's new
- Add
Model.useLimitInFirst
(opens new window) configuration flag.
# 0.8.4
# What's new
- New shorthand methods
joinEager
(opens new window),naiveEager
(opens new window),mergeJoinEager
(opens new window) andmergeNaiveEager
(opens new window). - New shorthand method
findOne
(opens new window) - New reflection method
isFindQuery
(opens new window) - ManyToMany extra properties can now be updated #413 (opens new window)
# 0.8.3
# What's new
NaiveEagerAlogrithm
(opens new window)- Aliases in relation expressions (opens new window) #402 (opens new window)
- New lazily evaluated
raw
function. #275 (opens new window)
# 0.8.2
# What's new
Model.namedFilters
(opens new window) object for defining shared filters that can be used by name in eager expressions.- Full support for views and table aliases in eager, join, joinRelation etc. #181 (opens new window)
- Fix
bindTransaction
bug withManyToManyRelation
junction tables #395 (opens new window)
# 0.8.1
# What's new
throwIfNotFound
(opens new window) method for making empty query results throw an exception.- fix error when passing model instance to a
where
method. #387 (opens new window)
# 0.8.0
# What's new
- All query methods now call
Model.query
to create aQueryBuilder
instance #346 (opens new window) - Objection is no longer transpiled. One of the implications is that you can use a github link in package.json to test experimental versions.
count
can now be called without arguments #364 (opens new window)- A new
getRelations
method for plugin development and other reflection greatness.
# Breaking changes
Old model definition
function Person() {
Model.apply(this, arguments);
}
Model.extend(Person);
Person.tableName = 'Person';
Person.prototype.fullName = function () {
return this.firstName + ' ' + this.lastName;
};
// More static and prototype methods.
Easiest way to migrate to
class
andextends
keywords
class Person extends Model {}
Person.tableName = 'Person';
Person.prototype.fullName = function () {
return this.firstName + ' ' + this.lastName;
};
// More static and prototype methods.
Support for node versions below 4.0.0 has been removed. With it the support for legacy class inheritance using
Model.extend
method has also been removed. This means that you need to change your model definitions to use theclass
andextends
keywords. To achieve this with the minimum amount of changes you can simply swap the constructor function andModel.extend
to a class definition. You can still define all static and prototype methods and properties the old way. See the example on the right -->Note that this also affects Babel transpilation. You cannot (or need to) use
babel-plugin-transform-es2015-classes
anymore. See the ESNext example project (opens new window) as an example of how to setup babel.The default value of
pickJsonSchemaProperties
was changed tofalse
. Before, all properties that were not listed injsonSchema
were removed beforeinsert
,patch
orupdate
(ifjsonSchma
was defined). Starting from this version you need to explicitly set the value totrue
. You may have been used this feature by accident. If you have weird problems after the update, try settingobjection.Model.pickJsonSchemaProperties = true;
to see if it helps.relate
andunrelate
methods now return the result of the underlying query (patch
in case ofHasManyRelation
,HasOneRelation
, andBelongsToOneRelation
.insert
otherwise). Before the method input was always returned.Model.RelatedQueryBuilder
is removed.Model.QueryBuilder
is now used to create all query builders for the model. This only affects you if you have defined custom query builders.
# 0.7.12
# What's new
# 0.7.11
# What's new
# 0.7.10
# What's new
- fix bugs that prevented using
$relatedQuery
andeager
together withJoinEagerAlgorithm
- typing updates
# 0.7.9
# What's new
joinRelation
(opens new window) now acceptsRelationExpressions
(opens new window) and can join multiple and nested relations.
# 0.7.6
# What's new
range
andpage
methods now use a window function and only generate one query on postgresql #62 (opens new window)- fix MSSQL 2100 parameter limit in eager queries #311 (opens new window)
# 0.7.5
# What's new
# 0.7.4
# What's new
- automatically select columns needed for relations #309 (opens new window)
- fix an issue where
$formatJson
was called insideinsertGraph
#326 (opens new window)
# 0.7.3
# What's new
- fix #325 (opens new window)
- fix an issue where
select
had to be used in addition todistinct
in some cases
# 0.7.2
# What's new
HasOneThroughRelation
relation type.
# 0.7.1
# What's new
- fix
JoinEagerAlgorithm
NPE bug
# 0.7.0
# What's new
jsonSchema
withoutproperties
now works. #205 (opens new window)relationMappings
can now be a function. #227 (opens new window)- many to many extras can now be aliased. #223 (opens new window)
- zero values are now allowed in relation columns. #228 (opens new window)
- active transaction can now be accessed in
$before/$after
hooks throughqueryContext.transaction
property. - Validation can now be easily modified through a new
Validator
interface. #241 (opens new window) #199 (opens new window) - fix a
JoinEager
problem where an empty result for a relation caused the following relations to be empty. #292 (opens new window) ref(fieldExpression)
syntax to reduce need for knex.raw and updating single attribute inside JSON column. #270 (opens new window)- mergeEager (opens new window) method.
# Breaking changes
$relatedQuery
now returns a single model instead of an array for belongsToOne and hasOne relations. #155 (opens new window)- identifier of a model can now be updated. Be careful with this one! Before if you forgot a wrong id in an
update
/patch
operation, it would simply get ignored. Now the id is also updated just like any other column #100 (opens new window) Table.*
is now selected by default in all queries instead of*
. This will break some join queries that don't have an explicit select clause. #161 (opens new window)ValidationError.data
is now an object including, for each key, a list of errors with context info. #283 (opens new window)
# 0.6.2
# What's new
relationMappings
can now be a function #227 (opens new window)
# 0.6.1
# What's new
- fix bug #205 (opens new window)
# 0.6.0
# What's new
- Eager loading can now be done using joins and zero extra queries. See
eagerAlgorithm
,defaultEagerAlgorithm
andeager
for more info. #ref
in graph inserts can now contain extra properties for many-to-many relations #156 (opens new window)#dbRef
can now be used to refer to existing rows from ainsertWithRelated
graph.modelPaths
attribute for cleaner way to point to models in relationMappings.pickJsonSchemaProperties
config parameter #110 (opens new window)insertGraphAndFetch
withinsertWithRelatedAndFetch
alias. #172 (opens new window)- Added
$beforeDelete
and$afterDelete
hooks #112 (opens new window) - Old values can now be accessed from
$beforeUpdate
,$afterUpdate
,$beforeValidate
and$afterValidate
hooks #185 (opens new window) - Support length property #168 (opens new window)
- Make sure operations are executed in the order they are called #180 (opens new window)
- Fetch nothing if the
where
clauses hit no rows inupdate/patchAndFetchById
methods #189 (opens new window) - Lots of performance tweaks.
$loadRelated
andloadRelated
now return aQueryBuilder
.
# Breaking changes
Undefined values as query method arguments now throw an exception. Before they were just silently ignored and for example
delete().where('id', undefined)
caused the entire table to be deleted. skipUndefined (opens new window) method can be called for a query builder to handle the undefined values the old way.Deprecated method
dumpSql
is now removed.$loadRelated
andloadRelated
now return aQueryBuilder
. This may break your code is some rare cases where you have called a non-standard promise method likereflect
for the return value of these functions.
# 0.5.5
# What's new
# 0.5.4
# What's new
- bugfix: insertWithRelated now works with
additionalProperties = false
injsonSchema
- Add updateAndFetch and patchAndFetch methods for
$query
- bugfix: afterGet was not called for nested models in eager query
- Use ajv instad of tv4 for json schema validation
# 0.5.3
# What's new
- ES6 promise compatibility fixes.
# 0.5.1
# What's new
- $afterGet hook.
# 0.5.0
# What's new
- joinRelation family of query builder methods.
HasOneRelation
for creating inverse one-to-one relations.- Relations have been renamed
OneToOneRelation
-->BelongsToOneRelation
,OneToManyRelation
-->HasManyRelation
. The old names work, but have been deprecated. - withSchema now works as expected and sets the schema of all queries executed by the query builder the method is called for.
- filterEager method for better eager query filtering.
- extra properties feature for selecting/inserting columns from/to the join table in many-to-many relations.
- Eager query recursion depth can be controlled like so:
parent.^5
.
# 0.4.0
# What's new
- Query context feature. See #51 (opens new window) and these docs for more info.
- Composite key support.
- findById, deleteById, whereComposite and whereInComposite query builder methods.
# Breaking changes
There shouldn't be any major breaking changes. We moved from ES5 to ES7 + babel in this version so there are big changes in the codebase. If something comes up, please open an issue.
There are a few known corner cases that may break:
You can now define a model for the join table of
ManyToMany
relations inrelationMappings
. This is optional, but may be needed if you already have a model for aManyToMany
relation and you usesnake_case
tocamelCase
conversion for the column names. See the documentation on the through property of relationMappings.The repo no longer contains the actual built javascript. Only the ES7 code that is transpiled when the code is published to npm. Therefore you can no longer specify a git hash to package.json to use for example the HEAD version. We will start to publish alpha and RC versions to npm when something new and experimental is added to the library.
# 0.3.3
# What's new
- fix regression: QueryBuilder.from is broken.
# 0.3.2
# What's new
- Improved relation expression whitespace handling.
# 0.3.1
# What's new
whereJson*
methods can now be used inside functions given towhere
methods.- Added multiple missing knex methods to
QueryBuilder
.
# 0.3.0
# What's new
- insertWithRelated (opens new window) method for inserting model trees
- insertAndFetch (opens new window), updateAndFetchById (opens new window) and patchAndFetchById (opens new window) helper methods
- Filters for eager expressions
- New alternative way to use transactions
- Many performance updates related to cloning, serializing and deserializing model trees.
# Breaking changes
- QueryBuilder methods
update
,patch
anddelete
now return the number of affected rows. The new methodsupdateAndFetchById
andpatchAndFetchById
may help with the migration modelInstance.$query()
instance method now returns a single model instead of an array- Removed
Model.generateId()
method.$beforeInsert
can be used instead
# 0.2.8
# What's new
- ES6 inheritance support
- generator function support for transactions
- traverse,pick and omit methods for Model and QueryBuilder
- bugfix: issue #38
# 0.2.7
# What's new
- bugfix: fix #37 also for
$query()
. - Significant
toJson
/fromJson
performance boost.
# 0.2.6
# What's new
- bugfix: fix regression bug that broke dumpSql.
# 0.2.5
# What's new
- bugfix: fix regression bug that prevented values assigned to
this
in$before
callbacks from getting into the actual database query
# 0.2.4
# What's new
- bugfix: many-to-many relations didn't work correctly with a snake_case to camelCase conversion in the related model class.
# 0.2.3
# What's new
- Promise constructor is now exposed through
require('objection').Promise
.
# 0.2.2
# What's new
- $beforeUpdate, $afterUpdate, $beforeInsert etc. are now asynchronous and you can return promises from them.
- Added
Model.fn()
shortcut toknex.fn
. - Added missing
asCallback
andnodeify
methods forQueryBuilder
.
# 0.2.1
# What's new
- bugfix: Chaining
insert
withreturning
now returns all listed columns.
# 0.2.0
# What's new
- New name
objection.js
. $beforeInsert
,$afterInsert
,$beforeUpdate
and$afterUpdate
hooks forModel
.- Postgres jsonb query methods:
whereJsonEquals
,whereJsonSupersetOf
,whereJsonSubsetOf
and friends. whereRef
query method.- Expose
knex.raw()
throughModel.raw()
. - Expose
knex.client.formatter()
throughModel.formatter()
. QueryBuilder
can be used to make sub queries just like knex'sQueryBuilder
.- Possibility to use a custom
QueryBuilder
subclass by overridingModel.QueryBuilder
. - Filter queries/objects for relations.
- A pile of bug fixes.
# Breaking changes
- Project was renamed to objection.js. Migrate simply by replacing
moron
withobjection
.
# 0.1.0
First release.