不要怂,就是干,撸起袖子干!

Commit 34f4f8c8 by Mick Hansen

Merge pull request #2678 from mbroadst/supports-upserts

add dialect checks for upsert support
2 parents 313b78b8 63f11616
...@@ -34,6 +34,7 @@ AbstractDialect.prototype.supports = { ...@@ -34,6 +34,7 @@ AbstractDialect.prototype.supports = {
schemas: false, schemas: false,
transactions: true, transactions: true,
migrations: true, migrations: true,
upserts: true,
constraints: { constraints: {
restrict: true restrict: true
}, },
......
...@@ -12,7 +12,8 @@ var chai = require('chai') ...@@ -12,7 +12,8 @@ var chai = require('chai')
, dialect = Support.getTestDialect() , dialect = Support.getTestDialect()
, datetime = require('chai-datetime') , datetime = require('chai-datetime')
, _ = require('lodash') , _ = require('lodash')
, assert = require('assert'); , assert = require('assert')
, current = Support.sequelize;
chai.use(datetime); chai.use(datetime);
chai.config.includeStack = true; chai.config.includeStack = true;
...@@ -40,6 +41,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -40,6 +41,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
this.clock.restore(); this.clock.restore();
}); });
if (current.dialect.supports.upserts) {
describe('upsert', function () { describe('upsert', function () {
it('works with upsert on id', function () { it('works with upsert on id', function () {
return this.User.upsert({ id: 42, username: 'john' }).bind(this).then(function (created) { return this.User.upsert({ id: 42, username: 'john' }).bind(this).then(function (created) {
...@@ -91,4 +93,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -91,4 +93,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}); });
}); });
}); });
}
}); });
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!