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

Commit e6ea4f21 by Ruben Bridgewater

Remove unused parameters

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