v6.0.0@next
6.0.0 (2019-06-12)
Bug Fixes
Build System
- nodejs v8 and up (740fed0)
Code Refactoring
- cls: remove cls support (#10817) (c28e034)
- hooks: remove method aliases for hooks (#10880) (6ef449c)
- model: remove build in favor or constructor usage (#10852) (a1c6f16)
- operators: use namespaced symbol names for operators (#10830) (b933866)
- querying: remove operatorAliases support (#10818) (14f72cd)
BREAKING CHANGES
- hooks: In order to streamline API:
- All method style add hook functions have been removed in favor of a composition based approach.
- Hook names have been removed, you can add and remove them by function reference instead which was supported before.
- Another notable change that
this
inside of hooks no longer refers to the the the hook subject, it should not be used.
This affects Model
, Sequelize
and Transaction
.
Composition
Before: MyModel.beforeCreate(...)
After: MyModel.hooks.add('beforeCreate', ...)
Before: MyModel.addHook('beforeCreate', ...)
After: MyModel.hooks.add('beforeCreate', ...)
Before: MyModel.removeHook('beforeCreate', ...)
After: MyModel.hooks.remove('beforeCreate', ...)
Before: transaction.afterCommit(...)
After: transaction.hooks.add('afterCommit', ...)
Names
Before:
MyModel.addHook('beforeCreate', 'named', fn);
MyModel.removeHook('beforeCreate', 'named');
After:
MyModel.hooks.add('beforeCreate', fn);
MyModel.hooks.remove('beforeCreate', fn);
Scope
Before: MyModel.addHook('beforeCreate', function() { this.someMethod(); });
After: MyModel.hooks.add('beforeCreate', () => { MyModel.someMethod(); });
- cls: All CLS support has been removed.
Migration guide:
If you do not use CLS, you can ignore this.
Check all your usage of the .transaction
method and make you sure explicitly pass the transaction
object for each subsequent query.
- model:
Model.build
has been removed. UseModel.bulkBuild
ornew Model
instead.
Co-authored-by: Simon Schick demwizzy@gmail.com
- operators: If you have relied on accessing sequelize operators via
Symbol.for('gt')
etc. you must now prefix them withsequelize.operator
eg.
Symbol.for('sequelize.operator.gt')
- querying: Operator aliases were soft deprecated via the
opt-in
option
operatorAlises
in v5 they have been entirely removed.
Please refer to previous changelogs for the migration guide.
- Only NodeJS v8 and greater are now supported