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

Commit c3af8769 by Whitney Young

Added option for underscore table name.

1 parent 2a2e4206
Showing with 3 additions and 1 deletions
...@@ -26,6 +26,7 @@ module.exports = (function() { ...@@ -26,6 +26,7 @@ module.exports = (function() {
validate: {}, validate: {},
freezeTableName: false, freezeTableName: false,
underscored: false, underscored: false,
underscoredAll: false,
paranoid: false, paranoid: false,
whereCollection: null, whereCollection: null,
schema: null, schema: null,
...@@ -40,6 +41,7 @@ module.exports = (function() { ...@@ -40,6 +41,7 @@ module.exports = (function() {
}, options || {}) }, options || {})
this.sequelize = options.sequelize this.sequelize = options.sequelize
this.underscored = this.underscored || this.underscoredAll
// error check options // error check options
Utils._.each(options.validate, function(validator, validatorType) { Utils._.each(options.validate, function(validator, validatorType) {
...@@ -55,7 +57,7 @@ module.exports = (function() { ...@@ -55,7 +57,7 @@ module.exports = (function() {
this.name = name this.name = name
if (!this.options.tableName) { if (!this.options.tableName) {
this.tableName = this.options.freezeTableName ? name : Utils._.underscoredIf(Utils.pluralize(name, this.options.language), this.options.underscored) this.tableName = this.options.freezeTableName ? name : Utils._.underscoredIf(Utils.pluralize(name, this.options.language), this.options.underscoredAll)
} else { } else {
this.tableName = this.options.tableName this.tableName = this.options.tableName
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!