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

Commit d15618f0 by Overlook Motel

Removed tabs where should be spaces

1 parent 912e1b1a
...@@ -117,7 +117,7 @@ Mixin.hasOne = function(targetModel, options) { ...@@ -117,7 +117,7 @@ Mixin.hasOne = function(targetModel, options) {
* @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks * @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks
* @param {string} [options.as] The alias of this model. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the assocition, you should provide the same alias when eager loading and when getting assocated models. Defaults to the singularized version of target.name * @param {string} [options.as] The alias of this model. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the assocition, you should provide the same alias when eager loading and when getting assocated models. Defaults to the singularized version of target.name
* @param {string} [options.foreignKey] The name of the foreign key in the source table. Defaults to the name of target + primary key of target * @param {string} [options.foreignKey] The name of the foreign key in the source table. Defaults to the name of target + primary key of target
* @param {string} [options.onDelete='SET NULL'] * @param {string} [options.onDelete='SET NULL']
* @param {string} [options.onUpdate='CASCADE'] * @param {string} [options.onUpdate='CASCADE']
* @param {boolean} [options.constraints=true] Should on update and on delete constraints be enabled on the foreign key. * @param {boolean} [options.constraints=true] Should on update and on delete constraints be enabled on the foreign key.
*/ */
...@@ -203,7 +203,7 @@ Mixin.belongsTo = function(targetModel, options) { ...@@ -203,7 +203,7 @@ Mixin.belongsTo = function(targetModel, options) {
* @param {Model|string} [options.through] The name of the table that is used to join source and target in n:m associations. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it. * @param {Model|string} [options.through] The name of the table that is used to join source and target in n:m associations. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it.
* @param {string} [options.as] The alias of this model. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the assocition, you should provide the same alias when eager loading and when getting assocated models. Defaults to the singularized version of target.name * @param {string} [options.as] The alias of this model. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the assocition, you should provide the same alias when eager loading and when getting assocated models. Defaults to the singularized version of target.name
* @param {string} [options.foreignKey] The name of the foreign key in the source table. Defaults to the name of target + primary key of target * @param {string} [options.foreignKey] The name of the foreign key in the source table. Defaults to the name of target + primary key of target
* @param {string} [options.onDelete='SET NULL|CASCADE'] Cascade if this is a n:m, and set null if it is a 1:m * @param {string} [options.onDelete='SET NULL|CASCADE'] Cascade if this is a n:m, and set null if it is a 1:m
* @param {string} [options.onUpdate='CASCADE'] * @param {string} [options.onUpdate='CASCADE']
* @param {boolean} [options.constraints=true] Should on update and on delete constraints be enabled on the foreign key. * @param {boolean} [options.constraints=true] Should on update and on delete constraints be enabled on the foreign key.
*/ */
......
var AbstractDialect = function() { var AbstractDialect = function() {
} }
AbstractDialect.prototype.supports = { AbstractDialect.prototype.supports = {
'RETURNING': false, 'RETURNING': false,
'DEFAULT': true, 'DEFAULT': true,
'DEFAULT VALUES': false, 'DEFAULT VALUES': false,
'VALUES ()': false, 'VALUES ()': false,
'LIMIT ON UPDATE':false, 'LIMIT ON UPDATE':false,
schemas: false schemas: false
} }
module.exports = AbstractDialect module.exports = AbstractDialect
\ No newline at end of file
...@@ -6,8 +6,8 @@ var MysqlDialect = function(sequelize) { ...@@ -6,8 +6,8 @@ var MysqlDialect = function(sequelize) {
} }
MysqlDialect.prototype.supports = _.defaults({ MysqlDialect.prototype.supports = _.defaults({
'VALUES ()': true, 'VALUES ()': true,
'LIMIT ON UPDATE':true 'LIMIT ON UPDATE':true
}, Abstract.prototype.supports) }, Abstract.prototype.supports)
module.exports = MysqlDialect module.exports = MysqlDialect
...@@ -6,9 +6,9 @@ var PostgresDialect = function(sequelize) { ...@@ -6,9 +6,9 @@ var PostgresDialect = function(sequelize) {
} }
PostgresDialect.prototype.supports = _.defaults({ PostgresDialect.prototype.supports = _.defaults({
'RETURNING': true, 'RETURNING': true,
'DEFAULT VALUES': true, 'DEFAULT VALUES': true,
schemas: true schemas: true
}, Abstract.prototype.supports) }, Abstract.prototype.supports)
module.exports = PostgresDialect module.exports = PostgresDialect
...@@ -6,8 +6,8 @@ var SqliteDialect = function(sequelize) { ...@@ -6,8 +6,8 @@ var SqliteDialect = function(sequelize) {
} }
SqliteDialect.prototype.supports = _.defaults({ SqliteDialect.prototype.supports = _.defaults({
'DEFAULT': false, 'DEFAULT': false,
'DEFAULT VALUES': true 'DEFAULT VALUES': true
}, Abstract.prototype.supports) }, Abstract.prototype.supports)
module.exports = SqliteDialect module.exports = SqliteDialect
...@@ -253,11 +253,10 @@ InstanceValidator.prototype._builtinAttrValidate = function(value, field) { ...@@ -253,11 +253,10 @@ InstanceValidator.prototype._builtinAttrValidate = function(value, field) {
// Check for custom validator. // Check for custom validator.
if (typeof test === 'function') { if (typeof test === 'function') {
return validators.push(self._invokeCustomValidator(test, validatorType, return validators.push(self._invokeCustomValidator(test, validatorType, true, value, field))
true, value, field))
} }
var validatorPromise = self._invokeBuiltinValidator(value, test, validatorType, field); var validatorPromise = self._invokeBuiltinValidator(value, test, validatorType, field)
// errors are handled in settling, stub this // errors are handled in settling, stub this
validatorPromise.catch(noop) validatorPromise.catch(noop)
validators.push(validatorPromise) validators.push(validatorPromise)
......
...@@ -34,7 +34,7 @@ module.exports = (function() { ...@@ -34,7 +34,7 @@ module.exports = (function() {
if (!this.QueryGenerator._dialect.supports.schemas) { if (!this.QueryGenerator._dialect.supports.schemas) {
return this.sequelize.drop() return this.sequelize.drop()
} else { } else {
return this.showAllSchemas().map(function (schemaName, index, length) { return this.showAllSchemas().map(function (schemaName, index, length) {
return self.dropSchema(schemaName) return self.dropSchema(schemaName)
}) })
} }
......
module.exports = { module.exports = {
SELECT: 'SELECT', SELECT: 'SELECT',
BULKUPDATE: 'BULKUPDATE', BULKUPDATE: 'BULKUPDATE',
BULKDELETE: 'BULKDELETE' BULKDELETE: 'BULKDELETE'
} }
\ No newline at end of file
...@@ -58,7 +58,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -58,7 +58,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
done() done()
}) })
}).error(function(err) { }).error(function(err) {
done(err); done(err)
}); });
}) })
}) })
...@@ -943,7 +943,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -943,7 +943,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
expect(err).to.be.instanceof(Object) expect(err).to.be.instanceof(Object)
expect(err.validateTest).to.be.instanceof(Array) expect(err.validateTest).to.be.instanceof(Array)
expect(err.validateTest[0]).to.exist expect(err.validateTest[0]).to.exist
expect(err.validateTest[0].message).to.equal('Validation isInt failed') expect(err.validateTest[0].message).to.equal('Validation isInt failed')
done() done()
}) })
}) })
...@@ -956,7 +956,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -956,7 +956,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
expect(err.validateCustom).to.exist expect(err.validateCustom).to.exist
expect(err.validateCustom).to.be.instanceof(Array) expect(err.validateCustom).to.be.instanceof(Array)
expect(err.validateCustom[0]).to.exist expect(err.validateCustom[0]).to.exist
expect(err.validateCustom[0].message).to.equal('Length failed.') expect(err.validateCustom[0].message).to.equal('Length failed.')
done() done()
}) })
}) })
...@@ -969,7 +969,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -969,7 +969,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
expect(err.validateTest).to.exist expect(err.validateTest).to.exist
expect(err.validateTest).to.be.instanceof(Array) expect(err.validateTest).to.be.instanceof(Array)
expect(err.validateTest[0]).to.exist expect(err.validateTest[0]).to.exist
expect(err.validateTest[0].message).to.equal('Validation isInt failed') expect(err.validateTest[0].message).to.equal('Validation isInt failed')
done() done()
}) })
}) })
......
...@@ -98,10 +98,10 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () { ...@@ -98,10 +98,10 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
if (dialect === 'mariadb') { if (dialect === 'mariadb') {
expect(err.message).to.match(/Access denied for user/) expect(err.message).to.match(/Access denied for user/)
} else if (dialect === 'postgres') { } else if (dialect === 'postgres') {
// When the test is run with only it produces: // When the test is run with only it produces:
// Error: Error: Failed to authenticate for PostgresSQL. Please double check your settings. // Error: Error: Failed to authenticate for PostgresSQL. Please double check your settings.
// When its run with all the other tests it produces: // When its run with all the other tests it produces:
// Error: invalid port number: "99999" // Error: invalid port number: "99999"
expect(err.message).to.match(/invalid port number/) expect(err.message).to.match(/invalid port number/)
} else { } else {
expect(err.message).to.match(/Failed to authenticate/) expect(err.message).to.match(/Failed to authenticate/)
...@@ -743,7 +743,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () { ...@@ -743,7 +743,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
it("doesn't save an instance if value is not in the range of enums", function(done) { it("doesn't save an instance if value is not in the range of enums", function(done) {
this.Review.create({status: 'fnord'}).error(function(err) { this.Review.create({status: 'fnord'}).error(function(err) {
expect(err).to.be.instanceOf(Error); expect(err).to.be.instanceOf(Error);
expect(err.status[0].message).to.equal('Value "fnord" for ENUM status is out of allowed scope. Allowed values: scheduled, active, finished') expect(err.status[0].message).to.equal('Value "fnord" for ENUM status is out of allowed scope. Allowed values: scheduled, active, finished')
done() done()
}) })
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!