基于 Node.js 的 ORM,Sequelize 2.0.0RC7 发布

jopen 7年前

Sequelize.js 提供对 MySQL,MariaDB,SQLite 和 PostgreSQL 数据库的简单访问,通过映射数据库条目到对象,或者对象到数据库条目。简而言之,就是 ORM(Object-Relational-Mapper)。Sequelize.js 完全是使用 JavaScript 编写,适用于 Node.js 的环境。

Sequelize 2.0.0RC7 发布,此版本现已提供下载:Sequelize 3.0.0.RC7.zip,主要更新内容如下:

  • [FEATURE] Throw an error if no where clause is given toModel.destroy().

  • [BUG] Fixed issue withorder: sequelize.literal('string')

  • [FEATURE] addclone: truesupport to.get(). Is needed when usingdeleteon 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] addsequelize.escape(value)convenience method

  • [BUG] Fixes crash withfindAll({include: [Model], order: sequelize.literal()})

  • [FEATURE] Now possible to passcreatedAtandupdatedAtvalues toModel.create/Model.bulkCreatewhen using silent: true (when importing datasets with existing timestamps)

  • [FEATURE]instance.update()using default fields will now automatically also save and validate values provided viabeforeUpdatehooks

  • [BUG] Fixed bad SQL when updating a JSON attribute with a differentfield

  • [BUG] Fixed issue with creating and updating values of aDataTypes.ARRAY(DataTypes.JSON)attribute

  • [BUG]Model.bulkCreate([{}], {returning: true})will now correctly result in instances with primary key values.

  • [BUG]instance.save()withfields: [](as a result of.changed()being[]) will no result in a noop instead of an empty update query.

  • [BUG] Fixed case wherefindOrCreatecould return[null, true]when given adefaultsvalue that triggered a unique constraint error.

向后兼容改进

  • instance.update()using default fields will now automatically also save and validate values provided viabeforeUpdatehooks

  • Sequelize no longer supports case insensitive mysql enums

更多内容请看更新日志

来自:http://www.oschina.net/news/58633/sequelize-2-0-0-rc7