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

Commit 82c54e73 by Jan Aagaard Meier

Remove forgotten .only in unit tests. Fix updatequery validation for sqlite. Tem…

…porarily move mssql to allowed failures
1 parent e967a2eb
...@@ -18,7 +18,6 @@ env: ...@@ -18,7 +18,6 @@ env:
- DIALECT=postgres-native - DIALECT=postgres-native
- DIALECT=sqlite - DIALECT=sqlite
- DIALECT=mariadb - DIALECT=mariadb
- DIALECT=mssql
addons: addons:
postgresql: "9.4" postgresql: "9.4"
...@@ -41,9 +40,13 @@ matrix: ...@@ -41,9 +40,13 @@ matrix:
include: include:
- node_js: "0.10" - node_js: "0.10"
env: COVERAGE=true env: COVERAGE=true
- node_js: "0.12"
env: DIALECT=mssql
allow_failures: allow_failures:
- node_js: "0.10" - node_js: "0.10"
env: COVERAGE=true env: COVERAGE=true
- node_js: "0.12"
env: DIALECT=mssql
notifications: notifications:
hipchat: hipchat:
......
...@@ -168,18 +168,28 @@ var QueryGenerator = { ...@@ -168,18 +168,28 @@ var QueryGenerator = {
return Utils._.template(query)(replacements); return Utils._.template(query)(replacements);
}, },
updateQuery: function(tableName, attrValueHash, where, options) { updateQuery: function(tableName, attrValueHash, where, options, attributes) {
options = options || {}; options = options || {};
_.defaults(options, this.options); _.defaults(options, this.options);
attrValueHash = Utils.removeNullValuesFromHash(attrValueHash, options.omitNull, options); attrValueHash = Utils.removeNullValuesFromHash(attrValueHash, options.omitNull, options);
var query = 'UPDATE <%= table %> SET <%= values %> <%= where %>' var query = 'UPDATE <%= table %> SET <%= values %> <%= where %>'
, modelAttributeMap = {}
, values = []; , values = [];
if (attributes) {
_.each(attributes, function(attribute, key) {
modelAttributeMap[key] = attribute;
if (attribute.field) {
modelAttributeMap[attribute.field] = attribute;
}
});
}
for (var key in attrValueHash) { for (var key in attrValueHash) {
var value = attrValueHash[key]; var value = attrValueHash[key];
values.push(this.quoteIdentifier(key) + '=' + this.escape(value)); values.push(this.quoteIdentifier(key) + '=' + this.escape(value, (modelAttributeMap && modelAttributeMap[key] || undefined)));
} }
var replacements = { var replacements = {
...@@ -235,7 +245,7 @@ var QueryGenerator = { ...@@ -235,7 +245,7 @@ var QueryGenerator = {
// get populated on all databases as DEFAULT value // get populated on all databases as DEFAULT value
// i.e. mysql requires: DEFAULT CURRENT_TIMESTAMP // i.e. mysql requires: DEFAULT CURRENT_TIMESTAMP
template += ' DEFAULT <%= defaultValue %>'; template += ' DEFAULT <%= defaultValue %>';
replacements.defaultValue = this.escape(dataType.defaultValue); replacements.defaultValue = this.escape(dataType.defaultValue, dataType);
} }
if (dataType.unique === true) { if (dataType.unique === true) {
......
...@@ -266,7 +266,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() { ...@@ -266,7 +266,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() {
}); });
describe('datatype validations', function () { describe('datatype validations', function () {
describe.only('should throw validationerror', function () { describe('should throw validationerror', function () {
var User = current.define('user', { var User = current.define('user', {
age: Sequelize.INTEGER age: Sequelize.INTEGER
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!