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

Commit ad4b2c30 by Mick Hansen

Merge pull request #3873 from overlookmotel/tidy-addIndex

Tidy code for QueryInterface#addIndex
2 parents 12a12fc2 091bac8f
Showing with 4 additions and 12 deletions
...@@ -422,20 +422,12 @@ QueryInterface.prototype.renameColumn = function(tableName, attrNameBefore, attr ...@@ -422,20 +422,12 @@ QueryInterface.prototype.renameColumn = function(tableName, attrNameBefore, attr
}.bind(this)); }.bind(this));
}; };
QueryInterface.prototype.addIndex = function(tableName, _attributes, options, _rawTablename) { QueryInterface.prototype.addIndex = function(tableName, attributes, options, rawTablename) {
var attributes, rawTablename;
// Support for passing tableName, attributes, options or tableName, options (with a fields param which is the attributes) // Support for passing tableName, attributes, options or tableName, options (with a fields param which is the attributes)
if (Array.isArray(_attributes)) { if (!Array.isArray(attributes)) {
attributes = _attributes;
rawTablename = _rawTablename;
} else {
// Support for passing an options object with a fields attribute instead of attributes, options
options = _attributes;
attributes = options.fields;
rawTablename = options; rawTablename = options;
options = attributes;
attributes = options.fields;
} }
if (!rawTablename) { if (!rawTablename) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!