Skip to content

Latest commit

 

History

History
683 lines (596 loc) · 57.4 KB

changelog.md

File metadata and controls

683 lines (596 loc) · 57.4 KB

Next

  • [BUG] Fixed field support for increment and decrement.
  • [FEATURE/BUG] Raw queries always return all results (including affected rows etc). This means you should change all promise listeners on sequelize.query to use .spread instead of .then, unless you are passing a query type.
  • [BUG] Support for composite primary keys in upsert #3065

Backwards compatibility changes

  • The default query type for sequelize.query is now RAW - this means that two arguments (results and metadata) will be returned by default and you should use .spread
  • The 4th argument to sequelize.query has been deprecated in favor of options.replacements

2.0.0-rc8

  • [FEATURE] CLS Support. CLS is also used to automatically pass the transaction to any calls within the callback chain when using sequelize.transaction(function() ....
  • [BUG] Fixed issue with paranoid deletes and deletedAt with a custom field.
  • [BUG] No longer crahes on where: []
  • [FEATURE] Validations are now enabled by default for upsert.
  • [FEATURE] Preliminary support for include.through.where
  • [SECURITY/BUG] Fixed injection issue in direction param for order

2.0.0-rc7

  • [FEATURE] Throw an error if no where clause is given to Model.destroy().
  • [BUG] Fixed issue with order: sequelize.literal('string')
  • [FEATURE] add clone: true support to .get(). Is needed when using delete on values from a .get() (toJSON(), this.values). (.get() is just a reference to the values for performance reasons when there's no custom getters or includes)
  • [FEATURE] add sequelize.escape(value) convenience method
  • [BUG] Fixes crash with findAll({include: [Model], order: sequelize.literal()})
  • [FEATURE] Now possible to pass createdAt and updatedAt values to Model.create/Model.bulkCreate when using silent: true (when importing datasets with existing timestamps)
  • [FEATURE] instance.update() using default fields will now automatically also save and validate values provided via beforeUpdate hooks
  • [BUG] Fixed bad SQL when updating a JSON attribute with a different field
  • [BUG] Fixed issue with creating and updating values of a DataTypes.ARRAY(DataTypes.JSON) attribute
  • [BUG] Model.bulkCreate([{}], {returning: true}) will now correctly result in instances with primary key values.
  • [BUG] instance.save() with fields: [] (as a result of .changed() being []) will no result in a noop instead of an empty update query.
  • [BUG] Fixed case where findOrCreate could return [null, true] when given a defaults value that triggered a unique constraint error.

Backwards compatibility changes

  • instance.update() using default fields will now automatically also save and validate values provided via beforeUpdate hooks
  • Sequelize no longer supports case insensitive mysql enums
  • pg-hstore has been moved to a devDependency, Postgres users will have to install pg-hstore manually alongside pg: $ npm install pg pg-hstore

2.0.0-rc6

  • [BUG] Fixed issue with including by association reference and where

2.0.0-rc5

  • [BUG] Fixed issue with subquery creating include.where and a paranoid main model.#2749/#2769
  • UniqueConstraintErrors will now extend from ValidationError making it possible to catch both with .catch(ValidationError)
  • [FEATURE] Adds {save: false} for belongsTo relationship setters. user.setOrganization(organization, {save: false}) will then only set the foreign key value, but not trigger a save on user.
  • [FEATURE] When updating an instance _previousDataValues will now be updated after afterUpdate hooks have been run rather than before allowing you to use changed in afterUpdate
  • [BUG] Sequelize will no longer fail on a postgres constraint error not defined by Sequelize
  • [FEATURE] It's now possible to pass an association reference to include. var Owner = Company.belongsTo(User, {as: 'owner'}; Company.findOne({include: [Owner]});

Backwards compatibility changes

  • When updating an instance _previousDataValues will now be updated after afterUpdate hooks have been run rather than before allowing you to use changed in afterUpdate

2.0.0-rc4

  • [INTERNALS] Update inflection dependency to v1.5.3
  • [FEATURE] Replaced string error messages for connection errors with error objects. #2576
  • [FEATURE] Support for updating fields on duplicate key in bulk update (mysql only) #2692
  • [FEATURE] Basic support for Microsoft SQL Server
  • [INTERNALS] Deprecate migration logic. This is now implemented in umzug and the CLI.
  • [BUG] Fixed various inconsistencies with Instance.update and how it behaves together with create, fields and more.
  • [BUG] Fixed crash/bug when using include.where together with association.scope
  • [BUG] Fixed support for Instance.destroy() and field for postgres.

Backwards compatibility changes

  • Some of the string error messages for connection errors have been replaced with actual error instances. Checking for connection errors should now be more consistent.

2.0.0-rc3

  • [FEATURE] Added the possibility of removing multiple associations in 1 call #2338
  • [FEATURE] Undestroy method for paranoid models #2540
  • [FEATURE] Support for UPSERT
  • [BUG] Add support for field named the same as the attribute in reload, bulkCreate and save #2348
  • [BUG] Copy the options object in association getters. #2311
  • [BUG] Model#destroy() now supports field, this also fixes an issue with N:M#removeAssociation and field
  • [BUG] Customized error message can now be set for unique constraint that was created manually (not with sync, but e.g. with migrations) or that has fields with underscore naming. This was problem at least with postgres before.
  • [BUG] Fixed a bug where plain objects like { in: [...] } were not properly converted to SQL when combined with a sequelize method (fn, where etc.). Closes #2077
  • [BUG] Made the default for array search in postgres exact comparison instead of overlap
  • [BUG] Allow logging from individual functions even though the global logging setting is false. Closes #2571
  • [BUG] Allow increment/decrement operations when using schemata
  • [BUG] Allow createTable with schema
  • [BUG] Fix some issues with findAndCount and include
  • [INTERNALS] Update inflection dependency to v1.5.2
  • [REMOVED] Remove query generation syntactic sugar provided by node-sql, as well as the dependency on that module

Backwards compatibility changes

  • When eager-loading a many-to-many association, the attributes of the through table are now accessible through an attribute named after the through model rather than the through table name singularized. i.e. Task.find({include: Worker}) where the table name for through model TaskWorker is TableTaskWorkers used to produce { Worker: { ..., TableTaskWorker: {...} } }. It now produces { Worker: { ..., TaskWorker: {...} } }. Does not affect models where table name is auto-defined by Sequelize, or where table name is model name pluralized.
  • When using Model#find() with an order clause, the table name is prepended to the ORDER BY SQL. e.g. ORDER BY Task.id rather than ORDER BY id. The change is to avoid ambiguous column names where there are eager-loaded associations with the same column names. A side effect is that code like Task.findAll( { include: [ User ], order: [ [ 'Users.id', 'ASC' ] ] } ) will now throw an error. This should be achieved with Task.findAll( { include: [ User ], order: [ [ User, 'id', 'ASC' ] ] } ) instead.
  • Nested HSTORE objects are no longer supported. Use DataTypes.JSON instead.
  • In PG where: { arr: [1, 2] } where the arr column is an array will now use strict comparison (=) instead of the overlap operator (&&). To obtain the old behaviour, use where: { arr: { overlap: [1, 2] }}
  • The default fields for Instance#save (when not a new record) is now an intersection of the model attributes and the changed attributes making saves more atomic while still allowing only defined attributes.
  • Syntactic sugar for query generation was removed. You will no longer be able to call Model.dataset() to generate raw sql queries

2.0.0-rc2

  • [FEATURE] Added to posibility of using a sequelize object as key in sequelize.where. Also added the option of specifying a comparator
  • [FEATURE] Added countercache functionality to hasMany associations #2375
  • [FEATURE] Basic JSON support #2314
  • [BUG] Fixes regression bug with multiple hasMany between the same models with different join tables. Closes #2316
  • [BUG] Don't set autocommit in nested transactions #2418
  • [BUG] Improved field support

2.0.0-rc1

  • [BUG] Fixed an issue with foreign key object syntax for hasOne and belongsTo
  • [FEATURE] Added field and name to the object form of foreign key definitions
  • [FEATURE] Added support for calling Promise.done, thus explicitly ending the promise chain by calling done with no arguments. Done with a function argument still continues the promise chain, to maintain BC.
  • [FEATURE] Added scope to hasMany association definitions, provides default values to association setters/finders #2268
  • [FEATURE] We now support transactions that automatically commit/rollback based on the result of the promise chain returned to the callback.
  • [BUG] Only try to create indexes which don't already exist. Closes #2162
  • [FEATURE] Hooks are passed options
  • [FEATURE] Hooks need not return a result - undefined return is interpreted as a resolved promise
  • [FEATURE] Added find() hooks

Backwards compatibility changes

  • The fieldName property, used in associations with a foreign key object (A.hasMany(B, { foreignKey: { ... }}), has been renamed to name to avoid confusion with field.
  • The naming of the join table entry for N:M association getters is now singular (like includes)
  • Signature of hooks has changed to pass options to all hooks. Any hooks previously defined like Model.beforeCreate(values) now need to be Model.beforeCreate(values, options) etc.
  • Results returned by hooks are ignored - changes to results by hooks should be made by reference
  • Model.destroy() signature has been changed from (where, options) to (options), options now take a where parameter.
  • Model.update() signature has been changed from (values, where, options) to (values, options), options now take a where parameter.
  • The syntax for Model.findOrBuild has changed, to be more in line with the rest of the library. Model.findOrBuild(where, defaults); becomes Model.findOrBuild({ where: where, defaults: defaults });.

v2.0.0-dev13

We are working our way to the first 2.0.0 release candidate.

  • [FEATURE] Added to option of setting a timezone offset in the sequelize constructor (timezone option). This timezone is used when initializing a connection (using SET TIME ZONE or equivalent), and when converting a timestamp string from the DB to a JS date with mysql (postgres stores the timezone, so for postgres we rely on what's in the DB).
  • [FEATURE] Allow setting plural and singular name on the model (options.name in sequelize.define) and in associations (options.as) to circumvent issues with weird pluralization.
  • [FEATURE] Added support for passing an indexes array in options to sequelize.define. #1485. See API reference for details.
  • [FEATURE/INTERNALS] Standardized the output from QueryInterface.showIndex.
  • [FEATURE] Include deleted rows in find #2083
  • [FEATURE] Make addSingular and addPlural for n:m associations (fx addUser and addUsers now both accept an array or an instance.
  • [BUG] Hid dottie.transform on raw queries behind a flag (nest) #2064
  • [BUG] Fixed problems with transaction parameter being removed / not passed on in associations #1789 and #1968
  • [BUG] Fix problem with minConnections. #2048
  • [BUG] Fix default scope being overwritten #2087
  • [BUG] Fixed updatedAt timestamp not being set in bulk create when validate = true. #1962
  • [INTERNALS] Replaced lingo with inflection
  • [INTERNALS] Removed underscore.string dependency and moved a couple of helper functions from Utils._ to Utils
  • [INTERNALS] Update dependencies
    • validator 3.2.0 -> 3.16.1
    • moment 2.5.0 -> 2.7.0
    • generic-pool 2.0.4 -> 2.1.1
    • sql 0.35.0 -> 0.39.0
  • [INTERNALS] Use a transaction inside findOrCreate, and handle unique constraint errors if multiple calls are issues concurrently on the same transaction

Backwards compatibility changes

  • We are using a new inflection library, which should make pluralization and singularization in general more robust. However, a couple of pluralizations have changed as a result:
    • Person is now pluralized as people instead of persons
  • Accesors for models with underscored names are no longer camel cased automatically. For example, if you have a model with name my_model, and my_other_model.hasMany(my_model), the getter will now be instance_of_my_model.getMy_model instead of .getMyModel.
  • Removed support for setting sequelize.language. If your model names are not in english, use the name option provided by sequelize.name to defined singular and plural forms for your model.
  • Model names are now used more verbatim in associations. This means that if you have a model named Task (plural T), or an association specifying { as: 'Task' }, the tasks will be returned as relatedModel.Tasks instead of relatedModel.tasks. For more information and how to mitigate this, see https://github.com/sequelize/sequelize/wiki/Upgrading-to-2.0#inflection-replaces-lingo-and-changes-to-naming-conventions
  • Removed the freezeAssociations option - use model and assocation names instead to provide the plural form yourself
  • Removed sequelize.language option (not supported by inflection)
  • Error handling has been refactored. Code that listens for :
    • All Error classes properly inherit from Error and a common SequelizeBaseError base

    • Instance Validator returns a single instance of a ValidationError which contains an errors array property. This property contains individual error items for each failed validation.

    • ValidationError includes a get(path) method to find all broken validations for a path on an instance. To migrate existing error handling, switch from array indexing to using the get method:

      Old: err.validateCustom[0] New: err.get('validateCustom')[0]

  • The syntax for findOrCreate has changed, to be more in line with the rest of the library. Model.findOrCreate(where, defaults); becomes Model.findOrCreate({ where: where, defaults: defaults });.

v2.0.0-dev12

  • [FEATURE] You can now return a promise to a hook rather than use a callback
  • [FEATURE] There is now basic support for assigning a field name to an attribute name: {type: DataTypes.STRING, field: 'full_name'}
  • [FEATURE] It's now possible to add multiple relations to a hasMany association, modelInstance.addRelations([otherInstanceA, otherInstanceB])
  • [FEATURE] define() stores models in sequelize.models Object e.g. sequelize.models.MyModel
  • [FEATURE] The set / add / has methods for associations now allow you to pass the value of a primary key, instead of a full Instance object, like so: user.addTask(15);.
  • [FEATURE] Support for FOR UPDATE and FOR SHARE statements #1777
  • [FEATURE] n:m createAssocation now returns the target model instance instead of the join model instance
  • [FEATURE] Extend the foreignKey option for associations to support a full data type definition, and not just a string
  • [FEATURE] Extract CLI into separate projects.
  • [FEATURE] Sqlite now inserts dates with millisecond precision
  • [FEATURE] Sequelize.VIRTUAL datatype which provides regular attribute functionality (set, get, etc) but never persists to database.
  • [BUG] An error is now thrown if an association would create a naming conflict between the association and the foreign key when doing eager loading. Closes #1272
  • [BUG] Fix logging options for sequelize.sync
  • [BUG] find no longer applies limit: 1 if querying on a primary key, should fix a lot of subquery issues.
  • [BUG] Transactions now use the pool so you will never go over your pool defined connection limit
  • [BUG] Fix use of Sequelize.literal in eager loading and when renaming attributes #1916
  • [BUG] Use the provided name for a unique index if one is given, instead of concating the column names together #1944
  • [BUG] Create a composite primary key for doubled linked self reference #1891
  • [INTERNALS] bulkDeleteQuery was removed from the MySQL / abstract query generator, since it was never used internally. Please use deleteQuery instead.

Backwards compatibility changes

  • Sequelize now returns promises instead of its custom event emitter from most calls. This affects methods that return multiple values (like findOrCreate or findOrInitialize). If your current callbacks do not accept the 2nd success parameter you might be seeing an array as the first param. Either use .spread() for these methods or add another argument to your callback: .success(instance) -> .success(instance, created).
  • .success()/.done() and any other non promise methods are now deprecated (we will keep the codebase around for a few versions though). on('sql') persists for debugging purposes.
  • Model association calls (belongsTo/hasOne/hasMany) are no longer chainable. (this is to support being able to pass association references to include rather than model/as combinations)
  • QueryInterface no longer emits global events. This means you can no longer do things like QueryInterface.on('showAllSchemas', function ...
  • sequelize.showAllSchemas now returns an array of schemas, instead of an array containinig an array of schemas
  • sequelize.transaction() now returns a promise rather than a instance of Sequelize.Transaction
  • bulkCreate, bulkUpdate and bulkDestroy (and aliases) now take both a hooks and an individualHooks option, hooks defines whether or not to run the main hooks, and individualHooks defines whether to run hooks for each instance affected.
  • It is no longer possible to disable pooling, disable pooling will just result in a 1/1 pool.

v2.0.0-dev11

Caution: This release contains many changes and is highly experimental

  • [PERFORMANCE] increased build performance when using include, which speeds up findAll etc.
  • [BUG] Made it possible to use HSTORE both in attribute: HSTORE and attribute: { type: HSTORE } form. Thanks to @tomchentw #1458
  • [FEATURE] n:m now marks the columns of the through table as foreign keys and cascades them on delete and update by default.
  • [FEATURE] 1:1 and 1:m marks columns as foreign keys, and sets them to cascade on update and set null on delete. If you are working with an existing DB which does not allow null values, be sure to override those options, or disable them completely by passing constraints: false to your assocation call (M1.belongsTo(M2, { constraints: false})).
  • [BUG] Removed the hard dependency on pg, allowing users to use pg.js
  • [BUG] Fixed a bug with foreign keys pointing to attributes that were not integers. Now your primaryKey can be a string, and associations will still work. Thanks to @fixe #1544
  • [BUG] Fix a case where createdAt timestamp would not be set when updatedAt was disabled Thanks to @fixe #1543
  • [BUG] Fix a case where timestamps were not being write protected in set when underscored=true. janmeier #1523
  • [FEATURE/BUG] Prefetching/includes now fully support schemas
  • [FEATURE] Centralize logging. #1566
  • [FEATURE/BUG] hstore values are now parsed on find/findAll. Thanks to @nunofgs #1560
  • [FEATURE] Read cli options from a file. Thanks to @codeinvain #1540

Backwards compatibility changes

  • The notNull validator has been removed, use the Schema's allowNull property.
  • All Validation errors now return a sequelize.ValidationError which inherits from Error.
  • selectedValues has been removed for performance reasons, if you depend on this, please open an issue and we will help you work around it.
  • foreign keys will now correctly be based on the alias of the model
    • if you have any 1:1 relations where both sides use an alias, you'll need to set the foreign key, or they'll each use a different foreign key based on their alias.
  • foreign keys for non-id primary keys will now be named for the foreign key, i.e. pub_name rather than pub_id
    • if you have non-id primary keys you should go through your associations and set the foreignKey option if relying on a incorrect _id foreign key
  • syncOnAssocation has been removed. It only worked for n:m, and having a synchronous function (hasMany) that invokes an asynchronous function (sync) without returning an emitter does not make a lot of sense. If you (implicitly) depended on this feature, sequelize.sync is your friend. If you do not want to do a full sync, use custom through models for n:m (M1.hasMany(M2, { through: M3})) and sync the through model explicitly.
  • Join tables will be no longer be paranoid (have a deletedAt timestamp added), even though other models are.
  • All tables in select queries will now be aliased with the model names to be support schemas. This will affect people stuff like `where: {'table.attribute': value}

v1.7.10

  • [FEATURE] ilike support for postgres #2122
  • [FEATURE] distinct option for count #2079
  • [BUG] various fixes

v1.7.9

  • [BUG] fixes issue with custom primary keys and N:M join tables #1929

v1.7.8

  • [FEATURE] adds rlike support for mysql

v1.7.7

  • [BUG] fixes issue where count/findAndCountAll would throw on empty rows #1849

v1.7.6

  • [BUG] fixes issue where primary key is also foreign key #1818

v1.7.5

  • [BUG] fixes bug with some methods relying on table information throwing strange errors #1686

v1.7.3

  • [BUG] fixes foreign key types for hasMany

v1.7.2

  • [BUG] fixes transactions support for 1-to-1 association setters.

v1.7.1

  • [BUG] fixes issue where relations would not use transactions probably in adders/setters.

v1.7.0

  • [FEATURE] covers more advanced include cases with limiting and filtering (specifically cases where a include would be in the subquery but its child include wouldnt be, for cases where a 1:1 association had a 1:M association as a nested include)
  • [BUG] fixes issue where connection would timeout before calling COMMIT resulting in data never reaching the database #1429

v1.7.0-rc9

  • [PERFORMANCE] fixes performance regression introduced in rc7
  • [FEATURE] include all relations for a model #1421
  • [BUG] N:M adder/getter with through model and custom primary keys now work

v1.7.0-rc8

  • [BUG] fixes bug with required includes without wheres with subqueries

v1.7.0-rc7

  • [BUG] ORDER BY statements when using includes should now be places in the appropriate sub/main query more intelligently.
  • [BUG] using include.attributes with primary key attributes specified should no longer result in multiple primary key attributes being selected #1410
  • [DEPENDENCIES] all dependencies, including Validator have been updated to the latest versions.

Backwards compatability changes

  • .set() will no longer set values that are not a dynamic setter or defined in the model. This only breaks BC since .set() was introduced but restores original .updateAttributes functionality where it was possible to 'trust' user input.

v1.7.0-rc6

  • [BUG] Encode binary strings as bytea in postgres, and fix a case where using a binary as key in an association would produce an error 1364. Thanks to @SohumB

v1.7.0-rc5

  • [FEATURE] sync() now correctly returns with an error when foreign key constraints reference unknown tables
  • [BUG] sync() no longer fails with foreign key constraints references own table (toposort self-dependency error)
  • [FEATURE] makes it possible to specify exactly what timestamp attributes you want to utilize #1334
  • [FEATURE] Support coffee script files in migrations. #1357
  • [FEATURE] include.where now supports Sequelize.and()/.or(). #1361

v1.7.0-rc4

  • [BUG] fixes issue with postgres sync and enums #1020
  • [BUG] fixes various issues with limit and includes #1322
  • [BUG] fixes issues with migrations/queryInterface createTable and enums
  • [BUG] migration/queryInterface.addIndex() no longer fails on reserved keywords like 'from'
  • [FEATURE] bulkCreate now supports a ignoreDuplicates option for MySQL, SQLite and MariaDB that will use INSERT IGNORE
  • [BUG] fixes regression bug with 1:M self associations
  • [FEATURE] significant performance improvements for 1:1 and single primary key includes for 500+ rows #1333

Backwards compatability changes

  • find/findAll will now always return primary keys regardless of attributes settings. (Motivation was to fix various issues with eager loading)

v1.7.0-rc3

  • [FEATURE] dropAllTables now takes an option parameter with skip as an option #1280
  • [FEATURE] implements .spread for eventemitters #1277
  • [BUG] fixes some of the mysql connection error bugs #1282
  • [Feature] Support for OR queries.
  • [Feature] Support for HAVING queries. #1286
  • [FEATURE] bulkUpdate and bulkDestroy now returns affected rows. #1293
  • [BUG] fixes transaction memory leak issue
  • [BUG] fixes security issue where it was possible to overwrite the id attribute when defined by sequelize (screwup - and fix - by mickhansen)

v1.7.0-rc2

  • [BUG] fixes unixSocket connections for mariadb #1248
  • [BUG] fixes a hangup issue for mysql #1244
  • [BUG] improves handling of uncaught errors in eventemitter #1245
  • [BUG] fixes bug with mysql replication and pool settings #1251
  • [BUG] fixes bug where through models created by N:M associations would inherit hooks #1263
  • [FEATURE] .col()/.literal()/etc now works with findAll #1249
  • [BUG] now currectly handles connection timeouts as errors #1207

v2.0.0 (alpha1)

  • [FEATURE] async validations. #580. thanks to Interlock

v1.7.0-rc1

  • [FEATURE] instance.createAssociationInstance functionality added #1213
  • [BUG] fixes a few bugs with transactions in regards to associations
  • [FEATURE] add error handling for transaction creation
  • [FEATURE] sequelize --undo will now actually undo migrations. Its basically an alias for sequelize --migrate --undo. #1059
  • [BUG] fix bug where {where: {ne: null}} would result in != NULL instead of IS NOT NULL #1231
  • [BUG] fixes a bug with validation skipping using the fields options. #1233
  • [BUG] fixes a bug with postgres and setters #1234
  • [BUG] fixes it so field: {type: Sequelize.ENUM(value1, value2)} works

Backwards compatability changes

  • Hooks are no longer passing value hashes. Instead, they are now passing instances of the model.
  • Hook callbacks no longer take two arguments (previously: err, newValues). They only take the error argument since values can be changed directly on the model instance.

v1.7.0-beta8

  • [FEATURE] max()/min() now supports dates #1200
  • [FEATURE] findAndCountAll now supports the include option

Backwards compatibility changes

  • You will now need to include the relevant subtables to query on them in finders (find/findAll)
  • Subquery logic no longer depends on where objects with keys containing '.', instead where options on the include options #1199

v1.7.0-beta7

  • [FEATURE] Nested eager loading / prefetching is now supported. Docs
  • [FEATURE] Eager loading / prefetching now supports inner joins and extending the ON statement #1199
  • [FEATURE] Eager loading / prefetching now returns the attributes of through models aswell #1198
  • [FEATURE] New set/get/changed/previous feature #1182
  • Various bug fixes

Backwards compatibility changes

None

v1.7.0-beta1

  • [DEPENDENCIES] Upgraded validator for IPv6 support. #603. thanks to durango
  • [DEPENDENCIES] replaced underscore by lodash. #954. thanks to durango
  • [DEPENDENCIES] Upgraded pg to 2.0.0. #711. thanks to durango
  • [DEPENDENCIES] Upgraded command to 2.0.0 and generic-pool to 2.0.4. thanks to durango
  • [DEPENDENCIES] No longer require semver. thanks to durango
  • [BUG] Fix string escape with postgresql on raw SQL queries. #586. thanks to zanamixx
  • [BUG] "order by" is now after "group by". #585. thanks to mekanics
  • [BUG] Added decimal support for min/max. #583. thanks to durango
  • [BUG] Null dates don't break SQLite anymore. #572. thanks to mweibel
  • [BUG] Correctly handle booleans in MySQL. #608. Thanks to terraflubb
  • [BUG] Fixed empty where conditions in MySQL. #619. Thanks to terraflubb
  • [BUG] Allow overriding of default columns. #635. Thanks to sevastos
  • [BUG] Fix where params for belongsTo #658. Thanks to mweibel
  • [BUG] Default ports are now declared in the connector manager, which means the default port for PG correctly becomes 5432. #633. durango
  • [BUG] Columns with type BOOLEAN were always added to toJSON output, even if they were not selected see. janmeier
  • [BUG] Hstore is now fully supported #695. thanks to tadman
  • [BUG] Correct join table name for tables with custom names #698. thanks to jjclark1982
  • [BUG] PostgreSQL should now be able to insert empty arrays with typecasting. #718. thanks to durango
  • [BUG] Fields should be escaped by quoteIdentifier for max/min functions which allows SQL reserved keywords to be used. #719. thanks to durango
  • [BUG] Fixed bug when trying to save objects with eagerly loaded attributes #716. thanks to iamjochen
  • [BUG] Strings for .find() should be fixed. Also added support for string primary keys to be found easily. #737. thanks to durango
  • [BUG] bulkCreate would have problems with a disparate field list #738. thanks to durango
  • [BUG] Fixed problems with quoteIdentifiers and {raw: false} option on raw queries #751. thanks to janmeier
  • [BUG] Fixed SQL escaping with sqlite and unified escaping #700. thanks to PiPeep
  • [BUG] Fixed Postgres' pools ff57af63
  • [BUG] Fixed BLOB/TEXT columns having a default value declared in MySQL #793. thanks to durango
  • [BUG] You can now use .find() on any single integer primary key when throwing just a number as an argument #796. thanks to durango
  • [BUG] Adding unique to a column for Postgres in the migrator should be fixed #795. thanks to durango
  • [BUG] For MySQL users, if their collation allows case insensitivity then allow enums to be case insensitive as well #794. thanks to durango
  • [BUG] Custom primary key (not keys, just singular) should no longer be a problem for models when using any of the data retrievals with just a number or through associations #771. thanks to sdephold & durango
  • [BUG] Default schemas should now be utilized when describing tables #812. thanks to durango
  • [BUG] Fixed eager loading for many-to-many associations. #834. thanks to lemon-tree
  • [BUG] allowNull: true enums can now be null #857. thanks to durango
  • [BUG] Fixes Postgres' ability to search within arrays. #879. thanks to durango
  • [BUG] Find and finAll would modify the options objects, now the objects are cloned at the start of the method #884 thanks to janmeier. Improved in #899 thanks to hackwaly
  • [BUG] Add support for typed arrays in SqlString.escape and SqlString.arrayToList #891. thanks to LJ1102
  • [BUG] Postgres requires empty array to be explicitly cast on update #890. thanks to robraux
  • [BUG] Added tests & bugfixes for DAO-Factory.update and array of values in where clause #880. thanks to domasx2
  • [BUG] sqlite no longer leaks a global db variable #900. thanks to xming
  • [BUG] Fix for counts queries with no result #906. thanks to iamjochem
  • [BUG] Allow include when the same table is referenced multiple times using hasMany #913. thanks to janmeier
  • [BUG] Allow definition of defaultValue for the timestamp columns (createdAt, updatedAt, deletedAt) #930. Thank to durango
  • [BUG] Don't delete foreign keys of many-to-many associations, if still needed. #961. thanks to sdepold
  • [BUG] Update timestamps when incrementing and decrementing #1023. durango
  • [FEATURE] Validate a model before it gets saved. #601. thanks to durango
  • [FEATURE] Schematics. #564. thanks to durango
  • [FEATURE] Foreign key constraints. #595. thanks to optilude
  • [FEATURE] Support for bulk insert (<DAOFactory>.bulkCreate(), update (<DAOFactory>.update()) and delete (<DAOFactory>.destroy()) #569. thanks to optilude
  • [FEATURE] Add an extra queryOptions parameter to DAOFactory.find and DAOFactory.findAll. This allows a user to specify { raw: true }, meaning that the raw result should be returned, instead of built DAOs. Usefull for queries returning large datasets, see #611 janmeier
  • [FEATURE] Added convenient data types. #616. Thanks to Costent
  • [FEATURE] Binary is more verbose now. #612. Thanks to terraflubb
  • [FEATURE] Promises/A support. #626. Thanks to kevinbeaty
  • [FEATURE] Added Getters/Setters method for DAO. #538. Thanks to iamjochem
  • [FEATURE] Added model wide validations. #640. Thanks to tremby
  • [FEATURE] findOrCreate now returns an additional flag (created), that is true if a model was created, and false if it was found #648. janmeier
  • [FEATURE] Field and table comments for MySQL and PG. #523. MySQL by iamjochen. PG by janmeier
  • [FEATURE] BigInts can now be used for autoincrement/serial columns. #673. thanks to sevastos
  • [FEATURE] Use moment for better postgres timestamp strings. #710. Thanks to seth-admittedly
  • [FEATURE] Keep milliseconds in timestamps for postgres. #712. Thanks to seth-admittedly
  • [FEATURE] You can now set lingo's language through Sequelize. #713. Thanks to durango
  • [FEATURE] Added a findAndCountAll, useful for pagination. #533. Thanks to iamjochen
  • [FEATURE] Made explicit migrations possible. #728. Thanks to freezy
  • [FEATURE] Added support for where clauses containing !=, < etc. and support for date ranges #727. Thanks to durango
  • [FEATURE] Added support for model instances being referenced #761 thanks to sdepold
  • [FEATURE] Added support for specifying the path to load a module for a dialect. #766 thanks to sonnym.
  • [FEATURE] Drop index if exists has been added to sqlite #766 thanks to coderbuzz
  • [FEATURE] bulkCreate() now has a third argument which gives you the ability to validate each row before attempting to bulkInsert #797. thanks to durango
  • [FEATURE] Added isDirty to model instances. #798. Thanks to mstorgaard
  • [FEATURE] Added possibility to use env variable for the database connection. #784. Thanks to sykopomp.
  • [FEATURE] Blob support. janmeier
  • [FEATURE] We can now define our own custom timestamp columns #856. thanks to durango
  • [FEATURE] Scopes. #748. durango
  • [FEATURE] Model#find() / Model#findAll() is now working with strings. #855. Thanks to whito.
  • [FEATURE] Shortcut method for getting a defined model. #868. Thanks to jwilm.
  • [FEATURE] Added Sequelize.fn() and Sequelize.col() to properly call columns and functions within Sequelize. #882. thanks to janmeier
  • [FEATURE] Sequelize.import supports relative paths. #901. thanks to accerqueira.
  • [FEATURE] Sequelize.import can now handle functions. #911. Thanks to davidrivera.
  • [FEATURE] Uses sequelize.fn and sequelize.col functionality to allow you to use the value of another column or a function when updating. It also allows you to use a function as a default value when supported (in sqlite and postgres). #928. thanks to janmeier
  • [FEATURE] Added possibility to pass options to node-mysql. #929. thanks to poying
  • [FEATURE] Triggers for Postgres. #915. Thanks to jonathana.
  • [FEATURE] Support for join tables. #877. Thanks to janmeier.
  • [FEATURE] Support for hooks. #894. Thanks to durango.
  • [FEATURE] Support for literals and casts. #950. Thanks to durango.
  • [FEATURE] Model#findOrBuild. #960. Thanks to durango.
  • [FEATURE] Support for MariaDB. #948. Thanks to reedog117 and janmeier.
  • [FEATURE] Filter through associations. #991. Thanks to snit-ram.
  • [FEATURE] Possibility to disable loging for .sync #937. Thanks to durango
  • [FEATURE] Support for transactions. 1062.
  • [REFACTORING] hasMany now uses a single SQL statement when creating and destroying associations, instead of removing each association seperately 690. Inspired by #104. janmeier
  • [REFACTORING] Consistent handling of offset across dialects. Offset is now always applied, and limit is set to max table size of not limit is given #725. janmeier
  • [REFACTORING] Moved Jasmine to Buster and then Buster to Mocha + Chai. sdepold and durango

v1.6.0

  • [DEPENDENCIES] upgrade mysql to alpha7. You MUST use this version or newer for DATETIMEs to work
  • [DEPENDENCIES] upgraded most dependencies. most important: mysql was upgraded to 2.0.0-alpha-3
  • [DEPENDENCIES] mysql is now an optional dependency. #355 (thanks to clkao)
  • [REFACTORING] separated tests for dialects
  • [REFACTORING] reduced number of sql queries used for adding an element to a N:M association. #449 (thanks to innofluence/janmeier)
  • [REFACTORING] dropped support for synchronous migrations. added third parameter which needs to get called once the migration has been finished. also this adds support for asynchronous actions in migrations.
  • [OTHERS] code was formatted to fit the latest code style guidelines (thanks to durango)
  • [OTHERS] Explicitly target ./docs folder for generate-docs script. #444 (thanks to carsondarling)
  • [OTHERS] Overwrite existing daoFactoryDefinition if there already has been one. (thanks to robraux)
  • [BUG] fixed wrong version in sequelize binary
  • [BUG] local options have higher priority than global options (thanks to guersam)
  • [BUG] fixed where clause when passing an empty array (thanks to kbackowski)
  • [BUG] fixed updateAttributes for models/tables without primary key (thanks to durango)
  • [BUG] fixed the location of the foreign key when using belongsTo (thanks to ricardograca)
  • [BUG] don't return timestamps if only specific attributes have been seleceted (thanks to ricardograca)
  • [BUG] fixed removeColumn for sqlite
  • [BUG] fixed date equality check for instances. (thanks to solotimes)
  • [FEATURE] added association prefetching /eager loading for find and findAll. #465
  • [FEATURE] it's now possible to use callbacks of async functions inside migrations (thanks to mphilpot)
  • [FEATURE] improved comfort of sequelize.query. just pass an sql string to it and wait for the result
  • [FEATURE] Migrations now understand NODE_ENV (thanks to gavri)
  • [FEATURE] Performance improvements (thanks to Mick-Hansen and janmeier from innofluence)
  • [FEATURE] Model.find and Model.findAll can now take a String with an ID. (thanks to ghernandez345)
  • [FEATURE] Compatibility for JSON-like strings in Postgres (thanks to aslakhellesoy)
  • [FEATURE] honor maxConcurrentQueries option (thanks to dchester)
  • [FEATURE] added support for stored procedures (inspired by wuyuntao)
  • [FEATURE] added possibility to use pg lib's native api (thanks to denysonique)
  • [FEATURE] added possibility to define the attributes of received associations (thanks to joshm)
  • [FEATURE] added findOrCreate, which returns a the already existing instance or creates one (thanks to eveiga)
  • [FEATURE] minConnections option for MySQL pooling (thanks to dominiklessel)
  • [FEATURE] added BIGINT data type which is treated like a string (thanks to adamsch1)
  • [FEATURE] experimental support for read replication for mysql (thanks to Janzeh)
  • [FEATURE] allow definition of a models table name (thanks to slamkajs)
  • [FEATURE] allow usage of enums. #440 (thanks to KevinMartin)
  • [FEATURE] allows updateAttributes to target specific fields only (thanks to Pasvaz)
  • [FEATURE] timestamps are now stored as UTC. #461 (thanks to innofluence/janmeier)
  • [FEATURE] results of raw queries are parsed with dottie. #468 (thanks to kozze89)
  • [FEATURE] support for array serialization. pg only. #443 (thanks to clkao)
  • [FEATURE] add increment and decrement methods on dao. #408 (thanks to janmeier/innofluence)
  • [FEATURE] unified the result of describeTable
  • [FEATURE] add support for decimals (thanks to alexyoung)
  • [FEATURE] added DAO.reload(), which updates the attributes of the DAO in-place (as opposed to doing having to do a find() and returning a new model)

v1.5.0

  • [REFACTORING] use underscore functions for Utils.isHash (thanks to Mick-Hansen/innofluence)
  • [REFACTORING] removed the 'failure' event and replaced it with 'error'
  • [BUG] fixed booleans for sqlite (thanks to vlmonk)
  • [BUG] obsolete reference attribute for many-to-many associations are removed correctly
  • [BUG] associations can be cleared via passing null to the set method
  • [BUG] "fixed" quota handling (thanks to dgf)
  • [BUG] fixed destroy in postgresql (thanks to robraux)
  • [FEATURE] added possibility to set protocol and to remove port from postgresql connection uri (thanks to danielschwartz)
  • [FEATURE] added possibility to not use a junction table for many-to-many associations on the same table (thanks to janmeier/innofluence)
  • [FEATURE] results of the import method is now cached (thanks to janmeier/innofluence)
  • [FEATURE] added possibility to check if a specific object or a whole bunch of objects is currently associated with another object (thanks to janmeier/innofluence)
  • [FEATURE] added possibility to globally disable adding of NULL values to sql queries (thanks to janmeier/innofluence)
  • [FEATURE] Model.create can now also be used to specify values for mass assignment (thanks to janmeier/innofluence)
  • [FEATURE] QueryChainer will now provide the results of the added emitters in the order the emitters have been added (thanks to LaurentZuijdwijk and me ;))
  • [FEATURE] QueryChainer can now be initialized with serial items
  • [FEATURE] node 0.8 compatibility
  • [FEATURE] added options to hasMany getters (thanks to janmeier/innofluence)
  • [FEATURE] pooling option is now correctly passed to postgres (thanks to megshark)

v1.4.1

  • [DEPRECATION] Added deprecation warning for node < v0.6.
  • [FEATURE] added selective saving of instances (thanks to kioopi)
  • [FEATURE] added command to binary for creating a migration skeleton with current timestamp
  • [FEATURE] added complete function for each finder method (thanks to sstoiana)
  • [BUG] fixed quotation for sqlite statements (thanks to vlmonk)
  • [BUG] fixed timestamp parsing in migratios (thanks to grn)
  • [FEATURE] added consistent logging behaviour to postgres (thanks to reacuna)

v1.4.0

  • [BUG] fixed booleans in sqlite (thanks to alexstrat)
  • [BUG] fixed forced sync of many-to-many associations (thanks to SirUli)
  • [FEATURE] objects are now compatible to JSON.stringify. (thanks to grayt0r)
  • [FEATURE] When instantiating the sequelize object, you can now pass a function to logging. This allows you to customize the logging behavior. Default is now: console.log (thanks to kenperkins)
  • [BUG] The default logging is still console.log but is wrapped after initialization as it crashes node < 0.6.x.
  • [FEATURE] postgresql support. (thanks to swoodtke)
  • [FEATURE] connection-pooling for mysql. (thanks to megshark)
  • [FEATURE] added possibility to define NOW as default value for date data-types. Use Sequelize.NOW as defaultValue
  • [BUG] Fixed date handling in sqlite (thanks to iizukanao)

v1.3.7

  • [BUG] fixed issue where multiple belongsTo or hasOne associations to the same table overwrite each other
  • [BUG] fixed memory leaks (thanks to megshark)

v1.3.6

  • [BUG] don't update an existing updatedAt-attribute if timestamps option for a DAO is false

v1.3.5

  • [BUG] fixed missed DAO renaming in migrations (thanks to nov)

v1.3.4

  • [REFACTORING] renamed Model/ModelFactory/ModelFactoryManager to DAO/DAOFactory/DAOFactoryManager
  • [IMPROVEMENT] npm test will run the test suite (thanks to gabrielfalcao)
  • [IMPROVEMENT] documentation about setting up local development environment (thanks to gabrielfalcao)
  • [REFACTORING] removed updatedAt + createdAt from SequelizeMeta

v1.3.3

  • [BUG] fixed sql-event emitter in all possible locations (thanks to megshark)

v1.3.2

  • [FEATURE] sqlite is now emitting the 'sql'-event as well (thanks to megshark)

v1.3.1

  • [REFACTORING] renamed ModelManager to ModelFactoryManager
  • [IMPROVEMENT] decreased delay of CustomEventEmitter execution from 5ms to 1ms
  • [IMPROVEMENT] improved performance of association handling (many-to-many) (thanks to magshark)
  • [FEATURE] added possibility to specify name of the join table (thanks to magshark)
  • [FEATURE] mysql is emitting a 'sql'-event when executing a query
  • [BUG] correctly delete existing SequelizeMeta entry from database after undoing migration
  • [BUG] fix path of migration files in executable (thanks to bcg)

v1.3.0

  • [REFACTORING] Model#all is now a function and not a getter.
  • [REFACTORING] Renamed ModelDefinition to ModelFactory
  • [REFACTORING] Private method scoping; Attributes are still public
  • [REFACTORING] Use the new util module for node 0.6.2
  • [FEATURE] QueryChainer can now run serially
  • [FEATURE] Association definition is chainable: Person.hasOne(House).hasMany(Address)
  • [FEATURE] Validations (Thanks to hiddentao)
  • [FEATURE] jQuery-like event listeners: .success(callback) and .error(callback)
  • [FEATURE] aliasing for select queries: Model.find({ where: 'id = 1', attributes: ['id', ['name', 'username']] }) ==> will return the user's name as username
  • [FEATURE] cross-database support. currently supported: mysql, sqlite
  • [FEATURE] migrations
  • [TEST] removed all expresso tests and converted them to jasmine

v1.2.1

  • [REFACTORING] renamed the global options for sync, query and define on sequelize; before: options.queryOptions; now: options.query
  • [FEATURE] allow definition of charset via global define option in sequelize or via charset option in sequelize.define
  • [FEATURE] allow definition of mysql engine via global define option in sequelize or via engine option in sequelize.define; default is InnoDB now
  • [FEATURE] find and findAll will now search in a list of values via: Model.findAll({where: { id: [1,2,3] }}); will return all models with id 1, 2 and 3
  • [TEST] force latin1 charset for travis

v1.2.0

  • [FEATURE] min/max function for models, which return the min/max value in a column
  • [FEATURE] getModel for modelManager for getting a model without storing it in a variable; use it via sequelize.modelManager.getModel('User')
  • [TEST] test suite refactoring for jasmine

v1.1.4

  • [BUG] tables with identical prefix (e.g. wp_) can now be used in many-to-many associations

v1.1.3

  • [BUG] scoped options in model => a model can now have the attribute options
  • [FEATURE] added drop method for sequelize, that drops all currently registered tables

v1.1.2

  • [BUG] prevent malfunction after being idle

v1.1.1

  • [BUG] fixed memory leaks
  • [FEATURE] added query queueing (adjustable via maxConcurrentQueries in config; default: 50)

v1.1.0

  • [BUG] defaultValue 0 is now working
  • [REMOVED] mysql-pool usage (will give it a new try later)
  • [CHORE] updated node-mysql to 0.9.4

v1.0.2

  • [BUG] Fixed where clause generation for models with explicit primary keys (allanca)
  • [BUG] Set insertId for non-default auto increment fields (allanca)

v1.0.1

  • [FEATURE] Added Model.count(callback), which returns the number of elements saved in the database
  • [BUG] Fixed self associations

v1.0.0

  • complete rewrite
  • added new emitter syntax
  • sql injection protection
  • select now supports hash usage of where
  • select now supports array usage of where
  • added a lot of options to find/findAll
  • Wrapped queries correctly using foo
  • using expresso 0.7.2
  • moved config for test database into seperated config file
  • Added method for adding and deleting single associations

v0.4.3

  • renamed loadAssociatedData to fetchAssociations
  • renamed Model#associatedData to fetchedAssociations
  • added fetchAssociations to finder methods
  • store data found by finder method in the associatedData hash + grep them from there if reload is not forced
  • added option to sequelize constructor for disabling the pluralization of tablenames: disableTableNameModification
  • allow array as value for chainQueries => Sequelize.chainQueries([save: [a,b,c]], callback)
  • remove the usage of an array => Sequelize.chainQueries({save: a}, {destroy: b}, callback)

v0.4.2

  • fixed bugs from 0.4.1
  • added the model instance method loadAssociatedData which adds the hash Model#associatedData to an instance which contains all associated data

v0.4.1

  • THIS UPDATE CHANGES TABLE STRUCTURES MASSIVELY!

  • MAKE SURE TO DROP YOUR CURRENT TABLES AND LET THEM CREATE AGAIN!

  • names of many-to-many-association-tables are chosen from passed association names

  • foreign keys are chosen from passed association name

  • added many-to-many association on the same model

  • added hasManyAndBelongsTo

  • added hasOneAndBelongsTo

  • nodejs-mysql-native 0.4.2

v0.4.0

  • added error handling when defining invalid database credentials
  • Sequelize#sync, Sequelize#drop, model#sync, model#drop returns errors via callback
  • code is now located under lib/sequelize to use it with nDistro
  • added possibility to use non default mysql database (host/port)
  • added error handling when defining invalid database port/host
  • schema definitions can now contain default values and null allowance
  • database credentials can now also contain an empty / no password

v0.3.0

  • added possibility to define class and instance methods for models
  • added import method for loading model definition from a file

v0.2.6

  • refactored Sequelize to fit CommonJS module conventions

v0.2.5

  • added BOOLEAN type
  • added FLOAT type
  • fixed DATE type issue
  • fixed npm package

v0.2.4

  • fixed bug when using cross associated tables (many to many associations)

v0.2.3

  • added latest mysql connection library
    • fixed id handling on save
    • fixed text handling (varchar > 255; text)
  • using the inflection library for naming tables more convenient
  • Sequelize.TEXT is now using MySQL datatype TEXT instead of varchar(4000)

v0.2.2

  • released project as npm package

v0.2.1

  • fixed date bug

v0.2.0

  • added methods for setting associations
  • added method for chaining an arbitraty amount of queries

v0.1.0

  • first stable version
  • implemented all basic functions
  • associations are working