Skip to content

v7.0.0-alpha.20

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 22 Dec 08:19
· 913 commits to v7 since this release
3fdfb14

7.0.0-alpha.20 (2022-12-22)

Bug Fixes

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 and mariadb (#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 and DROP 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 renamed AttributeOptions
  • setterMethods and getterMethods 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 to Model.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, and Where can be imported directly instead of using the Utils 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 now noTypeValidation and is false by default, meaning type validation of values passed to Model.create and Model.update are now checked.
  • DataTypes.NUMERIC has been removed, use DataTypes.DECIMAL.
  • DataTypes.NUMBER has been removed (no alternative, internal).
  • DataTypes['DOUBLE PRECISION'] has been removed, use DataTypes.DOUBLE.
  • DataTypes.JSONTYPE has been removed, use DataTypes.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, and DataTypes.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 and DataTypes.STRING.BINARY now mean "chars with a binary collation" and throw in dialects that do not support collations.
  • DataTypes.FLOAT now maps to REAL instead of FLOAT in all dialects except SQLite and MySQL
  • mssql - DataTypes.UUID now maps to UNIQUEIDENTIFIER instead of CHAR(36).