v7.0.0-alpha.20
Pre-release
Pre-release
github-actions
released this
22 Dec 08:19
·
913 commits
to v7
since this release
7.0.0-alpha.20 (2022-12-22)
Bug Fixes
- align QueryInterface type export with value exports (042a565)
- always escape string attributes (#15374) (344c404)
- fix parameters not being replaced when after $$ strings (#15306) (1a47fea)
- migrate
describeTableQuery
andshowIndexesQuery
to TS (#15299) (e1ba925) - migrate removeIndexQuery to TypeScript (#15406) (b44f9e0)
- mssql: allow bulkCreate to insert more than 1000 rows in mssql (#14689) (ed5f63d)
- mssql: force transactions if attempting to insert more than 1,000 rows (#15458) (cda75b9)
- postgres: invalidate connection after client-side timeout (#15144) (ff43e8d), closes /github.com/brianc/node-postgres/blob/5538df6b446f4b4f921947b460fe38acb897e579/packages/pg/lib/client.js#L529
- prevent model attribute being shadowed by class properties (#15480) (bb4d401)
- remove options.model overwrite on bulkUpdate (#15231) (c620469)
- support TS 4.9 and drop support TS 4.5 (#15284) (3b1ba33)
- throw on invalid where (#15375) (6c71dbd)
- types: add instance.dataValues property to model.d.ts (#15208) (81b1667)
- types: add to cast to projection alias (#15210) (5034f64)
- types: tableHint is missing for FindOptions (#15153) (b28ca6d)
- types: typo in typings (#15176) (c6bed01)
- unify and fix tests
queryGenerator.arithmeticQuery
/dropTableQuery
/showIndexesQuery
/describeTableQuery
(#15235) (c68f8c8) - use different default schema per dialect, escape quotes in identifiers instead of removing them, normalize Model.getTableName (#15274) (778c6dc)
Features
- add
@Index
, createIndexDecorator (#15482) (ab9aaba) - add
@AllowNull
,@AutoIncrement
,@Comment
,@Default
,@PrimaryKey
, and validation decorators (#15384) (08eb398) - add
@Attribute
&@Table
decorators (#15336) (fb8603b) - add
@Unique
decorator, support specifying multiple unique indexes on the same attribute (#15342) (43bca57) - add association decorators (#15483) (3770827)
- add model hook decorators (#15333) (bd037c8)
- add new postgres JSONB operators
?|
and?&
(#15073) (98dc4c2) - add support for add/drop column IF [NOT] EXISTS for
mssql
andmariadb
(#15261) (096ed3a) - added support for index include (#14900) (dacc806)
- allow using calculations in upsert on duplicate key by using literal values instead of
VALUES()
in mysql & mariadb (#14437) (9c2ae3c) - improved error reporting on associations (#14901) (8e3c626), closes #14161
- Migrate
createSchema()
to TypeScript (#15339) (a3d164f) - migrate hooks to TypeScript (#15131) (9cd8d89)
- migrate model definitions to TypeScript (#15431) (f57e5a0)
- postgres: add support for lock_timeout [#15345] (#15347) (5e7cbe6)
- postgres: support for
ADD COLUMN IF NOT EXISTS
andDROP COLUMN IF EXISTS
(#15119) (76cc97f) - remove
Utils
export (#15305) (a4f8e62) - rename ALS back to CLS (#15427) (766b2ea)
- replace CLS with ALS, enable ALS by default, discourage unmanaged transactions (#15292) (4cd43a4)
- restrict instance methods if no primary key (#15108) (3095d99)
- rewrite Data Types (#14505) (68b64f8)
- throw if accessing databaseVersion before it is loaded (#15346) (151a458)
- types: use retry-as-promised types for retry options to match documentation (#15400) (f2574ae)
BREAKING CHANGES
- Type
ModelAttributeColumnOptions
has been renamedAttributeOptions
setterMethods
andgetterMethods
model options, which were deprecated in a previous major version, have been removed. See https://sequelize.org/docs/v6/core-concepts/getters-setters-virtuals/#deprecated-in-sequelize-v7-gettermethods-and-settermethods for alternatives.- In the "references" attribute option, the "model" option has been split in two options: "table" and "model". "table" references a database table, and "model" references a Sequelize model.
- Sequelize will now throw if you try to define an attribute that conflicts (i.e. its options are incompatible) with one of the automatic timestamp or version attributes that are added on Models by Sequelize.
Model#validators
and many private state and methods have been removed from models and moved toModel.modelDefinition
- string attributes are always escaped as identifiers, including "*". See #15374 for details.
- The
where
option will now throw if it receives an unsupported value - The "Utils" export has been removed. Classes
Fn
,Col
,Cast
,Literal
,Json
, andWhere
can be imported directly instead of using theUtils
namespace. Other utilities are considered internal. - Some model instance methods cannot be used if the model doesn't have a primary key anymore. See #15108
- ibmi - dropTableQuery does not accept schema in the options anymore, use a tableName object
- The DataTypes API has changed. Custom DataTypes will need to be rewritten.
DataTypes.ENUM
: Specifying the list of values through{ type: DataTypes.ENUM, values: ['a', 'b'] }
is no longer supported. Use{ type: DataTypes.ENUM(['a', 'b']) }
instead.- Int DataTypes will reject number values if they are outside of the safe integer range. Use JS bigints or strings for big values.
- The
typeValidation
option is nownoTypeValidation
and is false by default, meaning type validation of values passed toModel.create
andModel.update
are now checked. DataTypes.NUMERIC
has been removed, useDataTypes.DECIMAL
.DataTypes.NUMBER
has been removed (no alternative, internal).DataTypes['DOUBLE PRECISION']
has been removed, useDataTypes.DOUBLE
.DataTypes.JSONTYPE
has been removed, useDataTypes.JSON
.- In raw queries that do not specify the JS DataType of a column, Dates are now returned as ISO 8601 strings instead of
Date
objects. This has been done in preparation for the arrival of Temporal. DataTypes.BOOLEAN
only accepts JS booleans. Strings, numbers, etc… will no longer be cast to boolean.DataTypes.STRING
,DataTypes.CITEXT
,DataTypes.TEXT
, andDataTypes.CHAR
will only accept strings. Buffers & numbers will not be stringified anymore.DataTypes.DECIMAL
with scale & precision left unspecified is now interpreted as an unconstrained decimal, and throws in dialects that do not support unconstrained decimals.- BigInt attributes will be returned as strings instead of JavaScript numbers, because they cannot be safely represented using that type.
DataTypes.FLOAT(precision)
is no longer accepted.FLOAT
is now always be single-precision floating point.DOUBLE
is now always be double-precision floating point.DataTypes.JSON
&DataTypes.JSONB
throw in dialects that do not support JSON.DataTypes.CHAR.BINARY
andDataTypes.STRING.BINARY
now mean "chars with a binary collation" and throw in dialects that do not support collations.DataTypes.FLOAT
now maps toREAL
instead ofFLOAT
in all dialects except SQLite and MySQL- mssql -
DataTypes.UUID
now maps toUNIQUEIDENTIFIER
instead ofCHAR(36)
.