Sequelize v4.0 發布 - Node.js 的 ORM

Sequelize.js 提供對 MySQL,MariaDB,SQLite 和 PostgreSQL 數據庫的簡單訪問,通過映射數據庫條目到對象,或者對象到數據庫條目。簡而言之,就是 ORM(Object-Relational-Mapper)。Sequelize.js 完全是使用 JavaScript 編寫,適用于 Node.js 的環境。
更新日志
- [FIXED] Pass ResourceLock instead of raw connection in MSSQL disconnect handling
- [CHANGED] Remove
hookValidatein favor ofvalidatewithhooks: true | false. - [REMOVED] Support for
referencesKey - [CHANGED] Throw if
dialectis not provided to the constructor - [CHANGED] Throw
bluebird.AggregateErrorinstead of array frombulkCreatewhen validation fails - [FIXED]
$notIn: []is now converted toNOT IN (NULL)#4859 - [FIXED] Add
rawsupport toinstance.get()#5815 - [ADDED] Compare deletedAt against current timestamp when using paranoid #5880
- [FIXED]
BIGINTgets truncated #5176 - [FIXED] Trigger afterCreate hook after all nested includes (for hasMany or belongsToMany associations) have been created to be consistent with hasOne.
- [REMOVED] Support for
pool:false - [REMOVED] Default transaction isolation level #5094
- [ADDED] Add logging for mysql warnings, observant of the
showWarningsoption. #5900 - [REMOVED] MariaDB dialect
- [FIXED]
hasOnenow prefer aliases to construct foreign key #5247 - [CHANGED]
instance.equalsnow only checks primary keys, instead of all attributes. - [REWRITE] Rewrite model and instance to a single class - instance instanceof Model #5924
- [REMOVED] Counter cache plugin
BC breaks:
hookValidateremoved in favor ofvalidatewithhooks: true | false.validatereturns a promise which is rejected if validation fails- Removed support for
referencesKey, use areferencesobject - Remove default dialect
- When
bulkCreateis rejected because of validation failure it throws abluebird.AggregateErrorinstead of an array. This object is an array-like so length and index access will still work, butinstanceofarray will not $notIn: []will now match all rows instead of none- (MySQL)
BIGINTnow gets converted to string when number is too big - Removed support for
pool:false, if you still want to use single connection setpool.maxto1 - Removed default
REPEATABLE_READtransaction isolation, use config option to explicitly set it - Removed MariaDB dialect - this was just a thin wrapper around MySQL, so using
dialect: 'mysql'instead should work with no further changes hasOnenow preferasoption to generate foreign key name, otherwise it defaults to source model nameinstance.equalsnow provides reference equality (do two instances refer to the same row, i.e. are their primary key(s) equal). Useinstance.get()to get and compare all values.- Instances (database rows) are now instances of the model, instead of being a separate class. This means you can replace User.build() with new User() and sequelize.define with User extends Sequelize.Model. See #5924
- The counter cache plugin, and consequently the
counterCacheoption for associations has been removed. The plugin is seeking a new maintainer - You can find the code here
下載
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!