Sequelize.js 3.0.0 发布,Node.js 的 ORM 框架 - 开源中国社区
Float_left Icon_close
Sequelize.js 3.0.0 发布,Node.js 的 ORM 框架
oschina 2015年05月19日

Sequelize.js 3.0.0 发布,Node.js 的 ORM 框架

oschina oschina 发布于2015年05月19日 收藏 35 评论 6

阿里云高性能云服务器,2折起! >>> >>>  

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

Sequelize.js 3.0.0 发布,此版本清理了废弃的代码,更好的维护和开发。

主要更新内容如下:

  • [ADDED] findById / findByPrimary takes a single value as argument representing the primary key to find.

  • [CHANGED] belongsToMany relations MUST now be given a through argument.

  • [CHANGED] findOne / findAll / findAndCount / findOrCreate now only takes a single options argument instead of a options and queryOptions argument. So set transaction, raw, etc on the first options argument.

  • [CHANGED] The accessor for belongsToMany relationships is now either the as argument or the target model name pluralized.

  • [REMOVED] N:M relationships can no longer be represented by 2 x hasMany

  • [REMOVED] Model.create / Model.bulkCreate / Instance.save no longer takes an array of fields as its second argument, use options.fields instead.

  • [REMOVED] Query Chainer has been removed

  • [REMOVED] Migrations have been removed, use umzug instead

  • [REMOVED] Model.findAllJoin has been removed

  • [REMOVED] sequelize.query now only takes sql and options as arguments, the second and fourth argument callee and replacements have been removed and should be set via options.instance / options.model and  options.replacements instead.

  • [REMOVED] instance.isDirty has been removed, use instance.changed() instead

  • [REMOVED] instance.values has been removed, use instance.get() instead

  • [REMOVED] instance.primaryKeyValues has been removed.

  • [REMOVED] instance.identifiers has been removed, use instance.where() instead

  • [REMOVED] instance.isDeleted has been removed, simply check the timestamp with get('deletedAt') instead

  • [REMOVED] instance.increment/decrement now longer takes a number as it's second argument.

  • [REMOVED/SECURITY] findOne no longer takes a string / integer / binary argument to represent a primaryKey. Use findById instead

  • [REMOVED/SECURITY] where: "raw query" is no longer legal, you must now explicitely use where: ["raw query", [replacements]]

  • [BUG] Fix showIndexQuery so appropriate indexes are returned when a schema is used

  • [BUG] Fix addIndexQuery error when the model has a schema

  • [BUG] Fix app crash in sqlite while running in special unique constraint errors #3730

  • [BUG] Fix bulkCreate: do not insert NULL for undefined values #3729

  • [BUG] Fix trying to roll back a comitted transaction if an error occured while comitting resulting in an unhandled rejection #3726

  • [BUG] Fix regression in beforeUpdate hook where instance.changed() would always be false #3727

  • [BUG] Fix trying to roll back a comitted transaction if an error occured while comitting

向后兼容改进

  • Most of the changes in 3.0.0 are BC breaking, read the changelog for 3.0.0 carefully.

  • The error that is thrown when a column is declared to be an enum but without any values used to "Values for ENUM haven't been defined" and is now "Values for ENUM have not been defined".

此版本现已提供下载:https://github.com/sequelize/sequelize/archive/v3.0.0.zip

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创开源社区。
转载请注明:文章转载自 开源中国社区 [http://www.oschina.net]
本文标题:Sequelize.js 3.0.0 发布,Node.js 的 ORM 框架
分享
评论(6)
最新评论
0

引用来自“要吃九个橙子”的评论

NodeJS ORM 那帮人是怎么想到的啊。。

引用来自“liluwei123”的评论

你做事务,就知道还是关系数据库方便点! 比如 财务系统!
除了索引,其他存成字符的json不就行了。
0

引用来自“要吃九个橙子”的评论

NodeJS ORM 那帮人是怎么想到的啊。。
你做事务,就知道还是关系数据库方便点! 比如 财务系统!
0

引用来自“Fover”的评论

mongodb不是已经很方便了么。。。。
这是给关系型数据库用的
0
mongodb不是已经很方便了么。。。。
0
可以玩一下
0
NodeJS ORM 那帮人是怎么想到的啊。。
顶部