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

Commit e6ea4f21 by Ruben Bridgewater

Remove unused parameters

1 parent b826d239
...@@ -133,7 +133,7 @@ module.exports = (function() { ...@@ -133,7 +133,7 @@ module.exports = (function() {
/* /*
* Find paired association (if exists) * Find paired association (if exists)
*/ */
_.each(this.target.associations, function(association, accessor) { _.each(this.target.associations, function(association) {
if (association.associationType !== 'BelongsToMany') return; if (association.associationType !== 'BelongsToMany') return;
if (association.target !== this.source) return; if (association.target !== this.source) return;
......
...@@ -49,11 +49,11 @@ module.exports = (function() { ...@@ -49,11 +49,11 @@ module.exports = (function() {
Defaults: { engine: 'InnoDB', charset: null } Defaults: { engine: 'InnoDB', charset: null }
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
createTableQuery: function(tableName, attributes, options) { createTableQuery: function() {
throwMethodUndefined('createTableQuery'); throwMethodUndefined('createTableQuery');
}, },
versionQuery: function(tableName, attributes, options) { versionQuery: function() {
throwMethodUndefined('versionQuery'); throwMethodUndefined('versionQuery');
}, },
...@@ -118,7 +118,7 @@ module.exports = (function() { ...@@ -118,7 +118,7 @@ module.exports = (function() {
- allowNull: Boolean - allowNull: Boolean
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
addColumnQuery: function(tableName, attributes) { addColumnQuery: function() {
throwMethodUndefined('addColumnQuery'); throwMethodUndefined('addColumnQuery');
}, },
...@@ -129,7 +129,7 @@ module.exports = (function() { ...@@ -129,7 +129,7 @@ module.exports = (function() {
- attributeName: Name of the obsolete attribute. - attributeName: Name of the obsolete attribute.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
removeColumnQuery: function(tableName, attributeName) { removeColumnQuery: function() {
throwMethodUndefined('removeColumnQuery'); throwMethodUndefined('removeColumnQuery');
}, },
...@@ -145,7 +145,7 @@ module.exports = (function() { ...@@ -145,7 +145,7 @@ module.exports = (function() {
- allowNull: Boolean - allowNull: Boolean
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
changeColumnQuery: function(tableName, attributes) { changeColumnQuery: function() {
throwMethodUndefined('changeColumnQuery'); throwMethodUndefined('changeColumnQuery');
}, },
...@@ -157,7 +157,7 @@ module.exports = (function() { ...@@ -157,7 +157,7 @@ module.exports = (function() {
- attrNameAfter: The name of the attribute, after renaming. - attrNameAfter: The name of the attribute, after renaming.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
renameColumnQuery: function(tableName, attrNameBefore, attrNameAfter) { renameColumnQuery: function() {
throwMethodUndefined('renameColumnQuery'); throwMethodUndefined('renameColumnQuery');
}, },
...@@ -274,7 +274,7 @@ module.exports = (function() { ...@@ -274,7 +274,7 @@ module.exports = (function() {
Parameters: table name + list of hashes of attribute-value-pairs. Parameters: table name + list of hashes of attribute-value-pairs.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
bulkInsertQuery: function(tableName, attrValueHashes) { bulkInsertQuery: function() {
throwMethodUndefined('bulkInsertQuery'); throwMethodUndefined('bulkInsertQuery');
}, },
...@@ -352,7 +352,7 @@ module.exports = (function() { ...@@ -352,7 +352,7 @@ module.exports = (function() {
/* /*
Returns an upsert query. Returns an upsert query.
*/ */
upsertQuery: function (tableName, insertValues, updateValues, where, rawAttributes, options) { upsertQuery: function () {
throwMethodUndefined('upsertQuery'); throwMethodUndefined('upsertQuery');
}, },
...@@ -373,7 +373,7 @@ module.exports = (function() { ...@@ -373,7 +373,7 @@ module.exports = (function() {
Note that truncate must ignore limit and where Note that truncate must ignore limit and where
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
deleteQuery: function(tableName, where, options) { deleteQuery: function() {
throwMethodUndefined('deleteQuery'); throwMethodUndefined('deleteQuery');
}, },
...@@ -535,7 +535,7 @@ module.exports = (function() { ...@@ -535,7 +535,7 @@ module.exports = (function() {
- database: Name of the database. - database: Name of the database.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
showIndexesQuery: function(tableName, options) { showIndexesQuery: function() {
throwMethodUndefined('showIndexesQuery'); throwMethodUndefined('showIndexesQuery');
}, },
...@@ -546,7 +546,7 @@ module.exports = (function() { ...@@ -546,7 +546,7 @@ module.exports = (function() {
- indexNameOrAttributes: The name of the index as string or an array of attribute names. - indexNameOrAttributes: The name of the index as string or an array of attribute names.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
removeIndexQuery: function(tableName, indexNameOrAttributes) { removeIndexQuery: function() {
throwMethodUndefined('removeIndexQuery'); throwMethodUndefined('removeIndexQuery');
}, },
...@@ -555,7 +555,7 @@ module.exports = (function() { ...@@ -555,7 +555,7 @@ module.exports = (function() {
sql attribute definition. sql attribute definition.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
attributesToSQL: function(attributes) { attributesToSQL: function() {
throwMethodUndefined('attributesToSQL'); throwMethodUndefined('attributesToSQL');
}, },
...@@ -563,7 +563,7 @@ module.exports = (function() { ...@@ -563,7 +563,7 @@ module.exports = (function() {
Returns all auto increment fields of a factory. Returns all auto increment fields of a factory.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
findAutoIncrementField: function(factory) { findAutoIncrementField: function() {
throwMethodUndefined('findAutoIncrementField'); throwMethodUndefined('findAutoIncrementField');
}, },
...@@ -693,8 +693,7 @@ module.exports = (function() { ...@@ -693,8 +693,7 @@ module.exports = (function() {
Create a trigger Create a trigger
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
createTrigger: function(tableName, triggerName, timingType, fireOnArray, functionName, functionParams, createTrigger: function() {
optionsArray) {
throwMethodUndefined('createTrigger'); throwMethodUndefined('createTrigger');
}, },
...@@ -702,7 +701,7 @@ module.exports = (function() { ...@@ -702,7 +701,7 @@ module.exports = (function() {
Drop a trigger Drop a trigger
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
dropTrigger: function(tableName, triggerName) { dropTrigger: function() {
throwMethodUndefined('dropTrigger'); throwMethodUndefined('dropTrigger');
}, },
...@@ -710,7 +709,7 @@ module.exports = (function() { ...@@ -710,7 +709,7 @@ module.exports = (function() {
Rename a trigger Rename a trigger
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
renameTrigger: function(tableName, oldTriggerName, newTriggerName) { renameTrigger: function() {
throwMethodUndefined('renameTrigger'); throwMethodUndefined('renameTrigger');
}, },
...@@ -718,7 +717,7 @@ module.exports = (function() { ...@@ -718,7 +717,7 @@ module.exports = (function() {
Create a function Create a function
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
createFunction: function(functionName, params, returnType, language, body, options) { createFunction: function() {
throwMethodUndefined('createFunction'); throwMethodUndefined('createFunction');
}, },
...@@ -726,7 +725,7 @@ module.exports = (function() { ...@@ -726,7 +725,7 @@ module.exports = (function() {
Drop a function Drop a function
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
dropFunction: function(functionName, params) { dropFunction: function() {
throwMethodUndefined('dropFunction'); throwMethodUndefined('dropFunction');
}, },
...@@ -734,7 +733,7 @@ module.exports = (function() { ...@@ -734,7 +733,7 @@ module.exports = (function() {
Rename a function Rename a function
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
renameFunction: function(oldFunctionName, params, newFunctionName) { renameFunction: function() {
throwMethodUndefined('renameFunction'); throwMethodUndefined('renameFunction');
}, },
...@@ -742,14 +741,14 @@ module.exports = (function() { ...@@ -742,14 +741,14 @@ module.exports = (function() {
Escape an identifier (e.g. a table or attribute name) Escape an identifier (e.g. a table or attribute name)
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
quoteIdentifier: function(identifier, force) { quoteIdentifier: function() {
throwMethodUndefined('quoteIdentifier'); throwMethodUndefined('quoteIdentifier');
}, },
/* /*
Split an identifier into .-separated tokens and quote each part Split an identifier into .-separated tokens and quote each part
*/ */
quoteIdentifiers: function(identifiers, force) { quoteIdentifiers: function(identifiers) {
if (identifiers.indexOf('.') !== -1) { if (identifiers.indexOf('.') !== -1) {
identifiers = identifiers.split('.'); identifiers = identifiers.split('.');
return this.quoteIdentifier(identifiers.slice(0, identifiers.length - 1).join('.')) + '.' + this.quoteIdentifier(identifiers[identifiers.length - 1]); return this.quoteIdentifier(identifiers.slice(0, identifiers.length - 1).join('.')) + '.' + this.quoteIdentifier(identifiers[identifiers.length - 1]);
...@@ -777,7 +776,7 @@ module.exports = (function() { ...@@ -777,7 +776,7 @@ module.exports = (function() {
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
getForeignKeysQuery: function(tableName, schemaName) { getForeignKeysQuery: function() {
throwMethodUndefined('getForeignKeysQuery'); throwMethodUndefined('getForeignKeysQuery');
}, },
...@@ -789,7 +788,7 @@ module.exports = (function() { ...@@ -789,7 +788,7 @@ module.exports = (function() {
* @return {String} The generated sql query. * @return {String} The generated sql query.
*/ */
/* istanbul ignore next */ /* istanbul ignore next */
dropForeignKeyQuery: function(tableName, foreignKey) { dropForeignKeyQuery: function() {
throwMethodUndefined('dropForeignKeyQuery'); throwMethodUndefined('dropForeignKeyQuery');
}, },
...@@ -1936,7 +1935,7 @@ module.exports = (function() { ...@@ -1936,7 +1935,7 @@ module.exports = (function() {
return dao; return dao;
}, },
isAssociationFilter: function(filterStr, dao, options) { isAssociationFilter: function(filterStr, dao) {
if (!dao) { if (!dao) {
return false; return false;
} }
......
...@@ -23,7 +23,7 @@ module.exports = (function() { ...@@ -23,7 +23,7 @@ module.exports = (function() {
* @param {String} sql - The SQL query which should be executed. * @param {String} sql - The SQL query which should be executed.
* @api public * @api public
*/ */
AbstractQuery.prototype.run = function(sql) { AbstractQuery.prototype.run = function() {
throw new Error('The run method wasn\'t overwritten!'); throw new Error('The run method wasn\'t overwritten!');
}; };
......
...@@ -96,7 +96,7 @@ module.exports = (function() { ...@@ -96,7 +96,7 @@ module.exports = (function() {
return Utils._.template(query)(values).trim() + ';'; return Utils._.template(query)(values).trim() + ';';
}, },
describeTableQuery: function(tableName, schema, schemaDelimiter) { describeTableQuery: function(tableName, schema) {
var sql = [ var sql = [
'SELECT', 'SELECT',
'c.COLUMN_NAME AS \'Name\',', 'c.COLUMN_NAME AS \'Name\',',
...@@ -129,7 +129,7 @@ module.exports = (function() { ...@@ -129,7 +129,7 @@ module.exports = (function() {
return 'SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES;'; return 'SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES;';
}, },
dropTableQuery: function(tableName, options) { dropTableQuery: function(tableName) {
var query = 'IF OBJECT_ID(\'<%= table %>\', \'U\') IS NOT NULL DROP TABLE <%= table %>'; var query = 'IF OBJECT_ID(\'<%= table %>\', \'U\') IS NOT NULL DROP TABLE <%= table %>';
var values = { var values = {
table: this.quoteTable(tableName) table: this.quoteTable(tableName)
...@@ -208,7 +208,7 @@ module.exports = (function() { ...@@ -208,7 +208,7 @@ module.exports = (function() {
outputFragment = ' OUTPUT INSERTED.*'; outputFragment = ' OUTPUT INSERTED.*';
} }
Utils._.forEach(attrValueHashes, function(attrValueHash, i) { Utils._.forEach(attrValueHashes, function(attrValueHash) {
// special case for empty objects with primary keys // special case for empty objects with primary keys
var fields = Object.keys(attrValueHash); var fields = Object.keys(attrValueHash);
if (fields.length === 1 && attributes[fields[0]].autoIncrement && attrValueHash[fields[0]] === null) { if (fields.length === 1 && attributes[fields[0]].autoIncrement && attrValueHash[fields[0]] === null) {
...@@ -217,7 +217,7 @@ module.exports = (function() { ...@@ -217,7 +217,7 @@ module.exports = (function() {
} }
// normal case // normal case
Utils._.forOwn(attrValueHash, function(value, key, hash) { Utils._.forOwn(attrValueHash, function(value, key) {
if (value !== null && attributes[key].autoIncrement) { if (value !== null && attributes[key].autoIncrement) {
needIdentityInsertWrapper = true; needIdentityInsertWrapper = true;
} }
...@@ -232,7 +232,7 @@ module.exports = (function() { ...@@ -232,7 +232,7 @@ module.exports = (function() {
}); });
if (allAttributes.length > 0) { if (allAttributes.length > 0) {
Utils._.forEach(attrValueHashes, function(attrValueHash, i) { Utils._.forEach(attrValueHashes, function(attrValueHash) {
tuples.push('(' + tuples.push('(' +
allAttributes.map(function(key) { allAttributes.map(function(key) {
return this.escape(attrValueHash[key]); return this.escape(attrValueHash[key]);
...@@ -299,7 +299,7 @@ module.exports = (function() { ...@@ -299,7 +299,7 @@ module.exports = (function() {
return Utils._.template(query)(replacements); return Utils._.template(query)(replacements);
}, },
showIndexesQuery: function(tableName, options) { showIndexesQuery: function(tableName) {
var sql = 'EXEC sys.sp_helpindex @objname = N\'<%= tableName %>\';'; var sql = 'EXEC sys.sp_helpindex @objname = N\'<%= tableName %>\';';
return Utils._.template(sql)({ return Utils._.template(sql)({
tableName: this.quoteTable(tableName) tableName: this.quoteTable(tableName)
...@@ -322,7 +322,7 @@ module.exports = (function() { ...@@ -322,7 +322,7 @@ module.exports = (function() {
return Utils._.template(sql)(values); return Utils._.template(sql)(values);
}, },
attributeToSQL: function(attribute, options) { attributeToSQL: function(attribute) {
if (!Utils._.isPlainObject(attribute)) { if (!Utils._.isPlainObject(attribute)) {
attribute = { attribute = {
type: attribute type: attribute
...@@ -444,28 +444,27 @@ module.exports = (function() { ...@@ -444,28 +444,27 @@ module.exports = (function() {
return fields; return fields;
}, },
createTrigger: function(tableName, triggerName, timingType, fireOnArray, functionName, functionParams, createTrigger: function() {
optionsArray) {
throwMethodUndefined('createTrigger'); throwMethodUndefined('createTrigger');
}, },
dropTrigger: function(tableName, triggerName) { dropTrigger: function() {
throwMethodUndefined('dropTrigger'); throwMethodUndefined('dropTrigger');
}, },
renameTrigger: function(tableName, oldTriggerName, newTriggerName) { renameTrigger: function() {
throwMethodUndefined('renameTrigger'); throwMethodUndefined('renameTrigger');
}, },
createFunction: function(functionName, params, returnType, language, body, options) { createFunction: function() {
throwMethodUndefined('createFunction'); throwMethodUndefined('createFunction');
}, },
dropFunction: function(functionName, params) { dropFunction: function() {
throwMethodUndefined('dropFunction'); throwMethodUndefined('dropFunction');
}, },
renameFunction: function(oldFunctionName, params, newFunctionName) { renameFunction: function() {
throwMethodUndefined('renameFunction'); throwMethodUndefined('renameFunction');
}, },
...@@ -583,19 +582,19 @@ module.exports = (function() { ...@@ -583,19 +582,19 @@ module.exports = (function() {
return fragment; return fragment;
}, },
findAssociation: function(attribute, dao) { findAssociation: function() {
throwMethodUndefined('findAssociation'); throwMethodUndefined('findAssociation');
}, },
getAssociationFilterDAO: function(filterStr, dao) { getAssociationFilterDAO: function() {
throwMethodUndefined('getAssociationFilterDAO'); throwMethodUndefined('getAssociationFilterDAO');
}, },
getAssociationFilterColumn: function(filterStr, dao, options) { getAssociationFilterColumn: function() {
throwMethodUndefined('getAssociationFilterColumn'); throwMethodUndefined('getAssociationFilterColumn');
}, },
getConditionalJoins: function(options, originalDao) { getConditionalJoins: function() {
throwMethodUndefined('getConditionalJoins'); throwMethodUndefined('getConditionalJoins');
}, },
......
...@@ -60,7 +60,7 @@ module.exports = (function() { ...@@ -60,7 +60,7 @@ module.exports = (function() {
// QUERY SUPPORT // QUERY SUPPORT
var results = []; var results = [];
var request = new self.connection.lib.Request(self.sql, function(err, rowCount) { var request = new self.connection.lib.Request(self.sql, function(err) {
promise.emit('sql', self.sql, self.connection.uuid); promise.emit('sql', self.sql, self.connection.uuid);
if (err) { if (err) {
......
...@@ -169,13 +169,13 @@ module.exports = (function() { ...@@ -169,13 +169,13 @@ module.exports = (function() {
, allAttributes = [] , allAttributes = []
, onDuplicateKeyUpdate = ''; , onDuplicateKeyUpdate = '';
Utils._.forEach(attrValueHashes, function(attrValueHash, i) { Utils._.forEach(attrValueHashes, function(attrValueHash) {
Utils._.forOwn(attrValueHash, function(value, key, hash) { Utils._.forOwn(attrValueHash, function(value, key) {
if (allAttributes.indexOf(key) === -1) allAttributes.push(key); if (allAttributes.indexOf(key) === -1) allAttributes.push(key);
}); });
}); });
Utils._.forEach(attrValueHashes, function(attrValueHash, i) { Utils._.forEach(attrValueHashes, function(attrValueHash) {
tuples.push('(' + tuples.push('(' +
allAttributes.map(function(key) { allAttributes.map(function(key) {
return this.escape(attrValueHash[key]); return this.escape(attrValueHash[key]);
...@@ -249,7 +249,7 @@ module.exports = (function() { ...@@ -249,7 +249,7 @@ module.exports = (function() {
return Utils._.template(sql)({ tableName: this.quoteIdentifiers(tableName), indexName: indexName }); return Utils._.template(sql)({ tableName: this.quoteIdentifiers(tableName), indexName: indexName });
}, },
attributeToSQL: function(attribute, options) { attributeToSQL: function(attribute) {
if (!Utils._.isPlainObject(attribute)) { if (!Utils._.isPlainObject(attribute)) {
attribute = { attribute = {
type: attribute type: attribute
...@@ -338,7 +338,7 @@ module.exports = (function() { ...@@ -338,7 +338,7 @@ module.exports = (function() {
return fields; return fields;
}, },
quoteIdentifier: function(identifier, force) { quoteIdentifier: function(identifier) {
if (identifier === '*') return identifier; if (identifier === '*') return identifier;
return Utils.addTicks(identifier, '`'); return Utils.addTicks(identifier, '`');
}, },
......
...@@ -28,7 +28,7 @@ module.exports = (function() { ...@@ -28,7 +28,7 @@ module.exports = (function() {
this.sequelize.log('Executing (' + (this.connection.uuid || 'default') + '): ' + this.sql, this.options); this.sequelize.log('Executing (' + (this.connection.uuid || 'default') + '): ' + this.sql, this.options);
var promise = new Utils.Promise(function(resolve, reject) { var promise = new Utils.Promise(function(resolve, reject) {
self.connection.query(self.sql, function(err, results, fields) { self.connection.query(self.sql, function(err, results) {
promise.emit('sql', self.sql, self.connection.uuid); promise.emit('sql', self.sql, self.connection.uuid);
if (err) { if (err) {
......
...@@ -90,7 +90,7 @@ ConnectionManager.prototype.connect = function(config) { ...@@ -90,7 +90,7 @@ ConnectionManager.prototype.connect = function(config) {
}); });
// Don't let a Postgres restart (or error) to take down the whole app // Don't let a Postgres restart (or error) to take down the whole app
connection.on('error', function(err, client) { connection.on('error', function() {
connection._invalid = true; connection._invalid = true;
}); });
}).tap(function (connection) { }).tap(function (connection) {
......
...@@ -453,7 +453,7 @@ module.exports = (function() { ...@@ -453,7 +453,7 @@ module.exports = (function() {
return Utils._.template(query)(replacements); return Utils._.template(query)(replacements);
}, },
showIndexesQuery: function(tableName, options) { showIndexesQuery: function(tableName) {
// This is ARCANE! // This is ARCANE!
var query = 'SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, ' + var query = 'SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, ' +
'array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) ' + 'array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) ' +
...@@ -478,7 +478,7 @@ module.exports = (function() { ...@@ -478,7 +478,7 @@ module.exports = (function() {
}); });
}, },
addLimitAndOffset: function(options, model) { addLimitAndOffset: function(options) {
var fragment = ''; var fragment = '';
if (options.limit) fragment += ' LIMIT ' + options.limit; if (options.limit) fragment += ' LIMIT ' + options.limit;
if (options.offset) fragment += ' OFFSET ' + options.offset; if (options.offset) fragment += ' OFFSET ' + options.offset;
...@@ -486,7 +486,7 @@ module.exports = (function() { ...@@ -486,7 +486,7 @@ module.exports = (function() {
return fragment; return fragment;
}, },
attributeToSQL: function(attribute, options) { attributeToSQL: function(attribute) {
if (!Utils._.isPlainObject(attribute)) { if (!Utils._.isPlainObject(attribute)) {
attribute = { attribute = {
type: attribute type: attribute
......
...@@ -88,7 +88,7 @@ module.exports = (function() { ...@@ -88,7 +88,7 @@ module.exports = (function() {
return !!value ? 1 : 0; return !!value ? 1 : 0;
}, },
addLimitAndOffset: function(options, model){ addLimitAndOffset: function(options){
var fragment = ''; var fragment = '';
if (options.offset && !options.limit) { if (options.offset && !options.limit) {
fragment += ' LIMIT ' + options.offset + ', ' + 10000000000000; fragment += ' LIMIT ' + options.offset + ', ' + 10000000000000;
...@@ -140,13 +140,13 @@ module.exports = (function() { ...@@ -140,13 +140,13 @@ module.exports = (function() {
, tuples = [] , tuples = []
, allAttributes = []; , allAttributes = [];
Utils._.forEach(attrValueHashes, function(attrValueHash, i) { Utils._.forEach(attrValueHashes, function(attrValueHash) {
Utils._.forOwn(attrValueHash, function(value, key, hash) { Utils._.forOwn(attrValueHash, function(value, key) {
if (allAttributes.indexOf(key) === -1) allAttributes.push(key); if (allAttributes.indexOf(key) === -1) allAttributes.push(key);
}); });
}); });
Utils._.forEach(attrValueHashes, function(attrValueHash, i) { Utils._.forEach(attrValueHashes, function(attrValueHash) {
tuples.push('(' + tuples.push('(' +
allAttributes.map(function (key) { allAttributes.map(function (key) {
return this.escape(attrValueHash[key]); return this.escape(attrValueHash[key]);
...@@ -418,7 +418,7 @@ module.exports = (function() { ...@@ -418,7 +418,7 @@ module.exports = (function() {
return sql.replace(/DEFAULT '?false'?/g, 'DEFAULT 0').replace(/DEFAULT '?true'?/g, 'DEFAULT 1'); return sql.replace(/DEFAULT '?false'?/g, 'DEFAULT 0').replace(/DEFAULT '?true'?/g, 'DEFAULT 1');
}, },
quoteIdentifier: function(identifier, force) { quoteIdentifier: function(identifier) {
if (identifier === '*') return identifier; if (identifier === '*') return identifier;
return Utils.addTicks(identifier, '`'); return Utils.addTicks(identifier, '`');
}, },
......
...@@ -678,7 +678,7 @@ module.exports = (function() { ...@@ -678,7 +678,7 @@ module.exports = (function() {
self.isNewRecord = false; self.isNewRecord = false;
return result; return result;
}) })
.tap(function(result) { .tap(function() {
if (!wasNewRecord) return; if (!wasNewRecord) return;
if (!self.options.include || !self.options.include.length) return; if (!self.options.include || !self.options.include.length) return;
...@@ -824,7 +824,7 @@ module.exports = (function() { ...@@ -824,7 +824,7 @@ module.exports = (function() {
where[self.Model.rawAttributes[self.Model.primaryKeyAttribute].field] = self.get(self.Model.primaryKeyAttribute, {raw: true}); where[self.Model.rawAttributes[self.Model.primaryKeyAttribute].field] = self.get(self.Model.primaryKeyAttribute, {raw: true});
return self.QueryInterface.delete(self, self.Model.getTableName(options), where, _.defaults(options, { type: QueryTypes.DELETE,limit: null})); return self.QueryInterface.delete(self, self.Model.getTableName(options), where, _.defaults(options, { type: QueryTypes.DELETE,limit: null}));
} }
}).tap(function(result) { }).tap(function() {
// Run after hook // Run after hook
if (options.hooks) { if (options.hooks) {
return self.Model.runHooks('afterDestroy', self, options); return self.Model.runHooks('afterDestroy', self, options);
...@@ -860,7 +860,7 @@ module.exports = (function() { ...@@ -860,7 +860,7 @@ module.exports = (function() {
}).then(function() { }).then(function() {
self.dataValues[self.Model._timestampAttributes.deletedAt] = null; self.dataValues[self.Model._timestampAttributes.deletedAt] = null;
return self.save(_.extend(_.clone(options), {hooks : false, omitNull : false})); return self.save(_.extend(_.clone(options), {hooks : false, omitNull : false}));
}).tap(function(result) { }).tap(function() {
// Run after hook // Run after hook
if (options.hooks) { if (options.hooks) {
return self.Model.runHooks('afterRestore', self, options); return self.Model.runHooks('afterRestore', self, options);
......
...@@ -69,7 +69,7 @@ module.exports = (function() { ...@@ -69,7 +69,7 @@ module.exports = (function() {
migrationTime = process.hrtime(); migrationTime = process.hrtime();
}, },
after: function(migration) { after: function() {
migrationTime = process.hrtime(migrationTime); migrationTime = process.hrtime(migrationTime);
migrationTime = Math.round((migrationTime[0] * 1000) + (migrationTime[1] / 1000000)); migrationTime = Math.round((migrationTime[0] * 1000) + (migrationTime[1] / 1000000));
...@@ -161,7 +161,7 @@ module.exports = (function() { ...@@ -161,7 +161,7 @@ module.exports = (function() {
Migrator.prototype.getCompletedMigrations = function(callback) { Migrator.prototype.getCompletedMigrations = function(callback) {
var self = this; var self = this;
var filterByMigrationId = function(migrations, allMigrationIds, callback) { var filterByMigrationId = function(migrations, allMigrationIds) {
return migrations.filter(function(migration) { return migrations.filter(function(migration) {
return allMigrationIds.indexOf(migration.migrationId) > -1; return allMigrationIds.indexOf(migration.migrationId) > -1;
}); });
......
...@@ -33,7 +33,7 @@ module.exports = (function() { ...@@ -33,7 +33,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) {
return self.dropSchema(schemaName); return self.dropSchema(schemaName);
}); });
} }
...@@ -72,7 +72,7 @@ module.exports = (function() { ...@@ -72,7 +72,7 @@ module.exports = (function() {
, sql = '' , sql = ''
, i = 0; , i = 0;
attributes = Utils._.mapValues(attributes, function(attribute, name) { attributes = Utils._.mapValues(attributes, function(attribute) {
if (!Utils._.isPlainObject(attribute)) { if (!Utils._.isPlainObject(attribute)) {
attribute = { type: attribute, allowNull: true }; attribute = { type: attribute, allowNull: true };
} }
...@@ -519,11 +519,11 @@ module.exports = (function() { ...@@ -519,11 +519,11 @@ module.exports = (function() {
} }
// Lets combine uniquekeys and indexes into one // Lets combine uniquekeys and indexes into one
indexes = Utils._.map(model.options.uniqueKeys, function (value, key) { indexes = Utils._.map(model.options.uniqueKeys, function (value) {
return value.fields; return value.fields;
}); });
Utils._.each(model.options.indexes, function (value, key) { Utils._.each(model.options.indexes, function (value) {
if (value.unique === true) { if (value.unique === true) {
// fields in the index may both the strings or objects with an attribute property - lets sanitize that // fields in the index may both the strings or objects with an attribute property - lets sanitize that
indexFields = Utils._.map(value.fields, function (field) { indexFields = Utils._.map(value.fields, function (field) {
......
...@@ -342,7 +342,7 @@ var Utils = module.exports = { ...@@ -342,7 +342,7 @@ var Utils = module.exports = {
}, },
// Converts {smart where} object(s) into an array that's friendly for Utils.format() // Converts {smart where} object(s) into an array that's friendly for Utils.format()
// NOTE: Must be applied/called from the QueryInterface // NOTE: Must be applied/called from the QueryInterface
compileSmartWhere: function(obj, dialect) { compileSmartWhere: function(obj) {
var self = this var self = this
, whereArgs = [] , whereArgs = []
, text = [] , text = []
...@@ -469,11 +469,11 @@ var Utils = module.exports = { ...@@ -469,11 +469,11 @@ var Utils = module.exports = {
return (tableName1.toLowerCase() < tableName2.toLowerCase()) ? (tableName1 + tableName2) : (tableName2 + tableName1); return (tableName1.toLowerCase() < tableName2.toLowerCase()) ? (tableName1 + tableName2) : (tableName2 + tableName1);
}, },
singularize: function(s, language) { singularize: function(s) {
return inflection.singularize(s); return inflection.singularize(s);
}, },
pluralize: function(s, language) { pluralize: function(s) {
return inflection.pluralize(s); return inflection.pluralize(s);
}, },
......
...@@ -19,7 +19,7 @@ var validateDeprecation = function(value, expectation, options) { ...@@ -19,7 +19,7 @@ var validateDeprecation = function(value, expectation, options) {
return valid; return valid;
}; };
var validate = function(value, expectation, options) { var validate = function(value, expectation) {
if (value instanceof expectation) { if (value instanceof expectation) {
return true; return true;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!