Skip to content

Releases

v1.9.17

Choose a tag to compare

@github-actions github-actions released this 27 Nov 11:06
9dbd92d

Fixed

  • reload() marks the instance as loaded by a query like v6, so get() and toJSON() no longer list the virtual getterMethods after a reload and a reloaded instance deep-equals the same row from a finder. Differential test in tests/compat/reload-queried.test.ts. (#288)
  • belongsToMany through a model that declares its own primary key keeps that key and gives the two foreign keys a unique key (uniqueKey, through.unique) like v6. It added both foreign keys to the primary key, so instance.update() of one was silently ignored. A junction model that declares only the foreign keys no longer keeps the automatic id, and a later association on a junction foreign key keeps its key. Behaviour change: primaryKeyAttributes, findByPk, upsert conflict target and the sync() schema of such models change; see the migrating guide. Differential test in tests/compat/btm-through-declared-pk.test.ts. (#290)

v1.9.16

Choose a tag to compare

@github-actions github-actions released this 27 Nov 01:34
f54cee2

Fixed

  • Two belongsToMany through the same model now take the other side's foreignKey as otherKey and its sourceKey as targetKey when these are not given (an extra column was generated and add / set failed), associations expose v6's identifier, foreignIdentifier, foreignIdentifierField, sourceKeyField and targetKeyField, and an attribute with references: null no longer crashes sync. Behaviour change: the junction table of such pairs gets different columns. Differential tests in tests/compat. (#257)
  • belongsTo / hasOne / hasMany / belongsToMany without a model throw v6's "called with something that's not a subclass of Sequelize.Model", and an unknown sourceKey / targetKey of belongsTo, hasOne and hasMany throws (it was accepted). Differential test in tests/compat/association-definition-errors.test.ts. (#261)
  • Declaring an association again under its default alias replaces it instead of throwing AssociationError; only a repeated explicit as throws. Differential test in tests/compat/default-alias-redefine.test.ts. (#262)
  • Behaviour change, deletes rows: the foreign key of hasOne / hasMany that cannot be NULL now gets ON DELETE CASCADE (it was NO ACTION), like Sequelize v6: once sync creates such a constraint, deleting a parent row deletes its children. belongsTo keeps NO ACTION. Pass onDelete: 'NO ACTION' to keep the old behaviour. Differential test in tests/compat/has-fk-delete-action.test.ts. (#263)
  • countX and hasX of belongsToMany read only the junction keys (they failed when the join table had no timestamp columns). Differential test in tests/compat/btm-count-without-timestamps.test.ts. (#272)

v1.9.15

Choose a tag to compare

@github-actions github-actions released this 27 Nov 00:48
e4da51e

Fixed

  • Deferrable.INITIALLY_IMMEDIATE(), INITIALLY_DEFERRED() and NOT() work like in v6 (they threw is not a function). Differential test in tests/compat/deferrable-callable.test.ts. sync({ alter: true }) still does not update a changed mode (filed as B-alter-deferrable-not-updated). (#254)
  • queryInterface.addIndex accepts null options (it threw TypeError) and sequelize.sync() without models checks the connection like v6 (it resolved against an unreachable server). Differential tests in tests/compat/sync-addindex-inputs.test.ts. (#259)
  • Index field objects may name their column with v6's attribute key in model indexes and addIndex (sync threw TypeError). Differential test in tests/compat/index-attribute-key.test.ts. (#264)
  • Removing a constraint that does not exist rejects with UnknownConstraintError (it was a plain DatabaseError). Differential test in tests/compat/unknown-constraint.test.ts. (#265)
  • sequelize.drop() removes the foreign keys first when tables reference each other in a cycle (it failed with "other objects depend on it"). Differential test in tests/compat/drop-cyclic.test.ts. (#266)
  • A foreign key named like the column of another attribute (foreignKey: 'user_id' next to userId: { field: 'user_id' }) makes one column on sync (it failed with "column specified more than once"). Differential test in tests/compat/fk-field-collision.test.ts. (#268)
  • STRING, CHAR, TEXT, BLOB, DECIMAL, FLOAT, REAL and DOUBLE accept v6's options object (STRING({ length: 12 }) threw). Differential test in tests/compat/data-type-options-object.test.ts. (#270)
  • createFunction accepts null options and null / {} characteristics, and createFunction / dropFunction report missing arguments with v6's messages (some threw TypeError). Differential test in tests/compat/function-arguments.test.ts. (#271)
  • When several models are mapped to one table, sequelize.sync syncs only the last one (it synced each, which could fail). Differential test in tests/compat/two-models-one-table.test.ts. (#275)

v1.9.14

Choose a tag to compare

@github-actions github-actions released this 27 Nov 00:15
707ec5a

Fixed

  • group: [['col']] groups by the column (the value was bound as a parameter). Differential test in tests/compat/group-nested-array.test.ts. (#260)
  • In raw queries a $ inside an identifier (foo$bar) is no longer read as a bind parameter, and an array inside an array replacement is written as a row (..) instead of being flattened. Differential tests in tests/compat/raw-query-tokens.test.ts. (#267)
  • aggregate selects the given attributes next to the aggregate, so group may name an alias, and a query with the deprecated logging: true logs to console.log instead of failing. Differential test in tests/compat/aggregate-alias-group.test.ts. (#273)
  • A pooled connection that was closed while idle is no longer handed out, a connection that fails while checked out leaves the pool at once (with pool.max: 1 the pool stayed exhausted), and connectionManager.validate is available. Differential test in tests/compat/pool-dead-connection.test.ts. (#276)

v1.9.13

Choose a tag to compare

@github-actions github-actions released this 26 Nov 23:25
14f5e87

Fixed

  • Model.aggregate joins its include (also the one of a scope), so a where on the include filters the rows, like v6. Differential test in tests/compat/aggregate-include.test.ts. (#250)
  • Model.update ignores undefined values and keys that are no attribute (they became NULL or a missing column), sends no query and resolves to [0] when nothing is left, and without options throws v6's Missing where attribute error instead of a TypeError. Differential test in tests/compat/update-values.test.ts. (#251)
  • Model.primaryKeyField and instance.rawAttributes exist like in v6, and countXs of a hasMany association with group resolves to the count of the first group. Differential test in tests/compat/model-v6-properties.test.ts. (#252)
  • Connection, constraint and aggregate errors can be constructed without arguments or with null like in v6 (they threw TypeError), DatabaseError keeps the sql and parameters of its parent, and String(aggregateError) lists the errors like v6. Differential test in tests/compat/error-constructors.test.ts. (#255)
  • define / init throw v6's errors for an unknown data type, ARRAY without an element type, a notNull validator on a nullable attribute, two auto increment attributes and invalid validate entries, and accept unique: null (it threw TypeError). Behaviour change: such definitions were accepted before. Differential test in tests/compat/definition-checks.test.ts. (#256)
  • An attribute named like an instance method (set, where, changed) no longer replaces the method; read and write it with get / set, as in Sequelize v6. Behaviour change: instance.<name> is the method, not the value. Differential test in tests/compat/attribute-named-like-method.test.ts. (#269)

v1.9.12

Choose a tag to compare

@github-actions github-actions released this 26 Nov 22:43
b82355e

Fixed

  • Validator (also Sequelize.Validator and sequelize.Validator) is a copy of validator.js with the v6 additions and extend(), and validators registered with it work in validate of attributes. Differential test in tests/compat/validator-extend.test.ts. (#253)
  • Model.scope('name') with a function scope calls it without arguments (it threw). Differential test in tests/compat/scope-function-by-name.test.ts. (#258)
  • A nested create with a belongsTo parent and a NOT NULL foreign key succeeds (it failed with "notNull Violation" before the parent was saved). Differential test in tests/compat/belongs-to-include-not-null.test.ts. (#274)

v1.9.11

Choose a tag to compare

@github-actions github-actions released this 26 Nov 21:50
c6c80e5

Fixed

  • Regression since 1.9.7: after update() (or save({ fields })) on a model with version, the next save of the same instance threw OptimisticLockError. Differential test in tests/compat/version-after-update.test.ts. (#277)

v1.9.10

Choose a tag to compare

@github-actions github-actions released this 26 Nov 17:33
eef7614

Fixed

  • An index declared with a truthy unique that is not true (indexes: [{ unique: 'users_name_address', fields }]) is created as a unique index and used as the conflict target of upsert and updateOnDuplicate, like v6 (upsert inserted a duplicate row). Differential test in tests/compat/upsert-named-unique-index.test.ts; one v6 suite baseline entry and the cause B-upsert-named-unique-index are gone. (#224)
  • queryInterface.createTable(name, attributes, { schema }) creates the table (and its enum types) in that schema, and describeTable(name, 'schema') reads it, like v6 (the table went to the default schema). Differential test in tests/compat/create-table-schema.test.ts; three v6 suite baseline entries and the causes C-createtable-schema-option and B-describetable-schema-arg are gone. (#232)
  • queryInterface.createTable(name, attributes, { uniqueKeys }) creates the composite unique constraints, like v6 (the option was ignored). Differential test in tests/compat/create-table-unique-keys.test.ts; one v6 suite baseline entry and the cause C-createtable-uniquekeys are gone. (#232)
  • Behaviour change: a foreign key added by addConstraint without a name is called <table>_<fields>_<referenced table>_fk like in v6 (it was <table>_<fields>_fkey), so migrations that remove it by the v6 name work. Differential test in tests/compat/constraint-default-name.test.ts; one v6 suite baseline entry and the cause C-fk-default-constraint-name are gone. (#234)
  • getForeignKeyReferencesForTable returns every field of v6 (tableName, tableSchema, tableCatalog, constraintSchema, constraintCatalog, referencedTableSchema, referencedTableCatalog, deferrable) besides the four it had. Differential test in tests/compat/foreign-key-references.test.ts; one v6 suite baseline entry and the cause C-fk-references-fields are gone. (#232)
  • queryInterface.changeColumn with references adds the foreign key (with onDelete / onUpdate), like v6, which then leaves the type and defaults of the column as they are (the references were ignored). Differential test in tests/compat/change-column-references.test.ts; two v6 suite baseline entries and the cause C-changecolumn-references are gone. (#236)
  • An index with type: 'unique' is created unique, and a JSONB attribute declared with index: true gets a gin index at sync, like v6. Differential test in tests/compat/index-conform.test.ts; the cause D-index-options-ignored is gone (its two v6 titles read the private Model._indexes and are filed as harness). (#224)

v1.9.9

Choose a tag to compare

@github-actions github-actions released this 26 Nov 16:49
50b3306

Fixed

  • A cast suffix on a nested JSON where key ({ meta: { 'level::integer': { [Op.gt]: 3 } } }) casts the value like v6 instead of being part of the key name (which matched no rows); unknown cast types are rejected with Invalid cast type. Differential test in tests/compat/json-where-cast.test.ts; three v6 suite baseline entries and the cause B-json-key-cast are gone. (#208)
  • sequelize.json('col.list[0].name') reads the array element like v6, in attributes and where, instead of treating list[0] as a key name. Differential test in tests/compat/json-path-index.test.ts; three v6 suite baseline entries and the cause B-json-path-index are gone. (#209)
  • { id: { [Op.not]: [1, 2] } } is NOT IN like v6, instead of comparing the column with an array. Differential test in tests/compat/where-op-not-array.test.ts; two v6 suite baseline entries and the cause A-op-not-array are gone. (#214)
  • In a sequelize.query with bind, $$ inside a string literal stands for $ like v6 (it stayed doubled); dollar-quoted blocks are left as they are. Differential test in tests/compat/bind-dollar-escape.test.ts; two v6 suite baseline entries and the cause C-bind-dollar-escape are gone. (#225)
  • The fieldMap option of sequelize.query renames the columns of SELECT rows like v6 (it was ignored). Differential test in tests/compat/query-field-map.test.ts; two v6 suite baseline entries and the cause C-query-fieldmap are gone. (#226)
  • Behaviour change: sequelize.query('SHOW ...') without a type resolves to the rows alone, like v6, instead of [rows, result]. Differential test in tests/compat/query-show-result.test.ts; three v6 suite baseline entries (two of them filed under C-client-min-messages) and the cause C-raw-show-result-shape are gone. (#226)
  • Parameters of a connection URI's query string that pg understands (options, application_name, statement_timeout, ...) and host are used like in v6 (they were ignored). Differential test in tests/compat/connection-uri-options.test.ts; one v6 suite baseline entry and the cause C-uri-query-options are gone. (#228)

v1.9.8

Choose a tag to compare

@github-actions github-actions released this 26 Nov 16:21
121f2be

Fixed

  • The typeValidation Sequelize option works like in v6: a value that does not fit the data type of its attribute (a string for INTEGER or DECIMAL, an unknown ENUM label, ...) is rejected with ValidationError on writes and in where before the statement runs. Differential test in tests/compat/type-validation.test.ts; five v6 suite baseline entries and the causes D-typevalidation-ignored and C-typevalidation-option are gone. (#205)
  • Includes of merged scopes and find options behave like v6: includes of different models are all kept (a non-array include replaced the other one) and entries of the same model and alias become one (the table was joined twice: table name specified more than once). Differential test in tests/compat/scope-include-merge.test.ts; five v6 suite baseline entries and the causes A-scope-include-replaced and A-include-merge-same-model are gone. (#217)
  • When save() writes the changed attributes, a new value that a beforeUpdate hook gives to any of them is validated again, like v6; an invalid value set by a hook on an attribute that was already changed was saved. Differential test in tests/compat/hook-changes-revalidated.test.ts; two v6 suite baseline entries and the cause B-hook-changes-not-revalidated are gone. (#218)
  • A Date in a nested JSON where is compared as timestamptz like v6 (it was bound as quoted JSON text and never matched), and IN / BETWEEN on a JSON path cast by the type of their values. Differential test in tests/compat/json-date-where.test.ts; one v6 suite baseline entry and the cause B-json-date-where are gone. (#205)
  • Behaviour change: like v6, a hook in the model options replaces the define.hooks hook of the same name instead of running after it. Differential test in tests/compat/define-hooks-override.test.ts; one v6 suite baseline entry and the cause D-define-hooks-merge are gone. (#229)