Releases: sequelize/sequelize
v3.24.0
First 4.0 pre-release!
This release marks the first in a long line of pre-releases leading up to the release of the final 4.0 version. Expect at least a couple of months before the final release. To get an idea of the set of BC breaks we plan to introduce, see https://github.com/sequelize/sequelize/issues?q=is%3Aopen+is%3Aissue+milestone%3A4.0 (this list is by no means exhaustive).
Two major things have changed in this release:
Instances are now instanceof
their model, instead of being of a separate class
Most notably you can now replace User.build()
with new User()
and sequelize.define
with User extends Sequelize.Model
(with the caveat that models defined by extending the Model
class must still be attached to the sequelize object via .init
). In the future this quirk can most likely be solved by decorators.
Sequelize now only officially supports node v4 and up
This decision has been hard, but we believe that the added features (most notably object literal extensions, template strings and generator coroutines) will be worth the switch. Additionally, cutting down the build matrix and switching coverage from codeclimate to coveralls (which supports parallel coverage jobs - it's awesome) has reduced build time from +30 to < 10 minutes. In the future we will test against the oldest active LTS, and the latest version of node.
Various pre-compilers (babel and typescript) were considered, but we have opted not to have a pre-compilation step. The reason for this is twofold; first of all we want to keep the barrier of entry low for new developers, and secondly we want users to be able to install directly from git, which is not possible if the code requires pre-compilation.
The current stable version has been branched out, and we will continue to accept and releases patches. However, do note that all development time from the core team will go towards 4.0.
This, and all future pre-release, will be published under the unstable
tag on npm. This means that npm install sequelize
and npm install sequelize@latest
will still install v3
. To opt into pre-releases use npm install sequelize@unstable
or npm install sequelize@4
.
What's new in this version (changelog)
- [FIXED] Pass ResourceLock instead of raw connection in MSSQL disconnect handling
- [CHANGED] Remove
hookValidate
in favor ofvalidate
withhooks: true | false
. - [REMOVED] Support for
referencesKey
- [CHANGED] Throw if
dialect
is not provided to the constructor - [CHANGED] Throw
bluebird.AggregateError
instead of array frombulkCreate
when validation fails - [FIXED]
$notIn: []
is now converted toNOT IN (NULL)
#4859 - [FIXED] Add
raw
support toinstance.get()
#5815 - [ADDED] Compare deletedAt against current timestamp when using paranoid #5880
- [FIXED]
BIGINT
gets truncated #5176 - [FIXED] Trigger afterCreate hook after all nested includes (for hasMany or belongsToMany associations) have been created to be consistent with hasOne.
- [REMOVED] Support for
pool:false
- [REMOVED] Default transaction isolation level #5094
- [ADDED] Add logging for mysql warnings, observant of the
showWarnings
option. #5900 - [REMOVED] MariaDB dialect
- [FIXED]
hasOne
now prefer aliases to construct foreign key #5247 - [CHANGED]
instance.equals
now only checks primary keys, instead of all attributes. - [REWRITE] Rewrite model and instance to a single class - instance instanceof Model #5924
- [REMOVED] Counter cache plugin
- [FIXED] All associations now prefer aliases to construct foreign key #5267
- [REMOVED] Default transaction auto commit #5094
- [REMOVED] Callback support for hooks #5228
BC breaks:
hookValidate
removed in favor ofvalidate
withhooks: true | false
.validate
returns a promise which is rejected if validation fails- Removed support for
referencesKey
, use areferences
object - Remove default dialect
- When
bulkCreate
is rejected because of validation failure it throws abluebird.AggregateError
instead of an array. This object is an array-like so length and index access will still work, butinstanceof
array will not $notIn: []
will now match all rows instead of none- (MySQL)
BIGINT
now gets converted to string when number is too big - Removed support for
pool:false
, if you still want to use single connection setpool.max
to1
- Removed default
REPEATABLE_READ
transaction isolation, use config option to explicitly set it - Removed MariaDB dialect - this was just a thin wrapper around MySQL, so using
dialect: 'mysql'
instead should work with no further changes hasOne
now preferas
option to generate foreign key name, otherwise it defaults to source model nameinstance.equals
now provides reference equality (do two instances refer to the same row, i.e. are their primary key(s) equal). Useinstance.get()
to get and compare all values.- Instances (database rows) are now instances of the model, instead of being a separate class. This means you can replace User.build() with new User() and sequelize.define with User extends Sequelize.Model. See #5924
- The counter cache plugin, and consequently the
counterCache
option for associations has been removed. The plugin is seeking a new maintainer - You can find the code here - All associations type will prefer
as
when constructing theforeignKey
name. You can override this byforeignKey
option. - Removed default
AUTO COMMIT
for transaction. Its only sent if explicitly set by user or required by dialects (likemysql
) - Hooks no longer provide a callback - you can return a
then
-able instead if you are doing async stuff
v3.23.3
- [FIXED] Pass ResourceLock instead of raw connection in MSSQL disconnect handling
v3.23.2
v3.23.1
v3.23.0
- [FIXED] Invalid query generated when using LIKE + ANY #5736
- [FIXED] Method QueryInterface.bulkDelete no longer working when the model parameter is missing. (PostgreSQL) #5615
- [ADDED] Context and custom options for deep creation
- [FIXED] Dates with millisecond precision are inserted correctly in MySQL #5855
3.22.0
v3.21.0
- [FIXED] Confirmed that values modified in validation hooks are preserved #3534
- [FIXED] Support lower case type names in SQLite #5482
- [FIXED] Support calling
setAssociation
twice onhasOne
#5315 - [INTERNALS] Removed dependency on wellknown in favor of terraformer-wkt-parser
- [ADDED] Benchmarking feature #2494
v3.20.0
- [ADDED] rejectOnEmpty mode #272 #5480
- [ADDED]
beforeCount
hook #5209 - [ADDED]
validationFailed
hook #1626 - [ADDED] Support for IEEE floating point literals in postgres and sqlite #5194
- [FIXED]
addColumn
with reference in mysql #5592 - [FIXED]
findAndCountAll
generates invalid SQL, subQuery moves to LEFT OUTER JOIN #5445 - [FIXED]
count
methods pollute the options.includes #4191 - [FIXED] Invalid SQL generated when using group option along with attributes #3009
- [FIXED] Mark index as
unique: true
whentype: 'UNIQUE'
. Fixes #5351 - [FIXED] Improper escaping of bound arrays of strings on Postgres, SQLite, and Microsoft SQL Server
v3.19.3
- [FIXED]
updatedAt
andcreatedAt
values are now set before validation #5367 - [FIXED]
describeTable
maintains proper enum casing in mysql #5321 - [FIXED] Parsing of dates in MySQL, when a named timezone is used #4208
- [FIXED] Truncating in Postgres, when table has a schema #4306
- [FIXED] Moved initialization of scopes later in the model init process. Fixes attribute exclusion in scopes, #4735 and #4925
- [FIXED] Multiple custom unique validation messages being overwritten by the first-defined message, #4920