Sequelize v4.0 发布 - Node.js 的 ORM
jopen 8年前
<p style="text-align:center"><img alt="" src="https://simg.open-open.com/show/2fa12c9af67545c2ae5fcc9ba49713ed.png" /></p> <p>Sequelize.js 提供对 MySQL,MariaDB,SQLite 和 PostgreSQL 数据库的简单访问,通过映射数据库条目到对象,或者对象到数据库条目。简而言之,就是 ORM(Object-Relational-Mapper)。Sequelize.js 完全是使用 JavaScript 编写,适用于 Node.js 的环境。</p> <h2>更新日志</h2> <ul> <li>[FIXED] Pass ResourceLock instead of raw connection in MSSQL disconnect handling</li> <li>[CHANGED] Remove <code>hookValidate</code> in favor of <code>validate</code> with <code>hooks: true | false</code>.</li> <li>[REMOVED] Support for <code>referencesKey</code></li> <li>[CHANGED] Throw if <code>dialect</code> is not provided to the constructor</li> <li>[CHANGED] Throw <code>bluebird.AggregateError</code> instead of array from <code>bulkCreate</code> when validation fails</li> <li>[FIXED] <code>$notIn: []</code> is now converted to <code>NOT IN (NULL)</code> <a href="/misc/goto?guid=4958990907559926863">#4859</a></li> <li>[FIXED] Add <code>raw</code> support to <code>instance.get()</code> <a href="/misc/goto?guid=4958990907660612916">#5815</a></li> <li>[ADDED] Compare deletedAt against current timestamp when using paranoid <a href="/misc/goto?guid=4958990907757291751">#5880</a></li> <li>[FIXED] <code>BIGINT</code> gets truncated <a href="/misc/goto?guid=4958990907839479121">#5176</a></li> <li>[FIXED] Trigger afterCreate hook after all nested includes (for hasMany or belongsToMany associations) have been created to be consistent with hasOne.</li> <li>[REMOVED] Support for <code>pool:false</code></li> <li>[REMOVED] Default transaction isolation level <a href="/misc/goto?guid=4958990907933904525">#5094</a></li> <li>[ADDED] Add logging for mysql warnings, observant of the <code>showWarnings</code> option. <a href="/misc/goto?guid=4958990908027648905">#5900</a></li> <li>[REMOVED] MariaDB dialect</li> <li>[FIXED] <code>hasOne</code> now prefer aliases to construct foreign key <a href="/misc/goto?guid=4958990908106793482">#5247</a></li> <li>[CHANGED] <code>instance.equals</code> now only checks primary keys, instead of all attributes.</li> <li>[REWRITE] Rewrite model and instance to a single class - instance instanceof Model <a href="/misc/goto?guid=4958990908204574899">#5924</a></li> <li>[REMOVED] Counter cache plugin</li> </ul> <h3>BC breaks:</h3> <ul> <li><code>hookValidate</code> removed in favor of <code>validate</code> with <code>hooks: true | false</code>. <code>validate</code> returns a promise which is rejected if validation fails</li> <li>Removed support for <code>referencesKey</code>, use a <code>references</code> object</li> <li>Remove default dialect</li> <li>When <code>bulkCreate</code> is rejected because of validation failure it throws a <code>bluebird.AggregateError</code>instead of an array. This object is an array-like so length and index access will still work, but<code>instanceof</code> array will not</li> <li><code>$notIn: []</code> will now match all rows instead of none</li> <li>(MySQL) <code>BIGINT</code> now gets converted to string when number is too big</li> <li>Removed support for <code>pool:false</code>, if you still want to use single connection set <code>pool.max</code> to <code>1</code></li> <li>Removed default <code>REPEATABLE_READ</code> transaction isolation, use config option to explicitly set it</li> <li>Removed MariaDB dialect - this was just a thin wrapper around MySQL, so using <code>dialect: 'mysql'</code>instead should work with no further changes</li> <li><code>hasOne</code> now prefer <code>as</code> option to generate foreign key name, otherwise it defaults to source model name</li> <li><code>instance.equals</code> now provides reference equality (do two instances refer to the same row, i.e. are their primary key(s) equal). Use <code>instance.get()</code> to get and compare all values.</li> <li>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 <a href="/misc/goto?guid=4958990908286439653">#5924</a></li> <li>The counter cache plugin, and consequently the <code>counterCache</code> option for associations has been removed. The plugin is seeking a new maintainer - You can find the code <a href="/misc/goto?guid=4958990908379234261">here</a></li> </ul> <h2>下载</h2> <ul> <li><a href="/misc/goto?guid=4958990908477764071" rel="nofollow"><strong>Source code</strong> (zip)</a></li> <li><a href="/misc/goto?guid=4958990908571185189" rel="nofollow"><strong>Source code</strong> (tar.gz)</a></li> </ul>