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

Commit aae77c43 by Mick Hansen

Try to maintain BC

1 parent db597c1d
...@@ -39,7 +39,7 @@ module.exports = (function() { ...@@ -39,7 +39,7 @@ module.exports = (function() {
, keyType = ((this.target.hasPrimaryKeys && targetKeys.length === 1) ? this.target.rawAttributes[targetKeys[0]].type : DataTypes.INTEGER) , keyType = ((this.target.hasPrimaryKeys && targetKeys.length === 1) ? this.target.rawAttributes[targetKeys[0]].type : DataTypes.INTEGER)
this.identifier = this.options.foreignKey || Utils._.underscoredIf(Utils.singularize(this.target.tableName, this.target.options.language) + "Id", this.source.options.underscored) this.identifier = this.options.foreignKey || Utils._.underscoredIf(Utils.singularize(this.target.tableName, this.target.options.language) + "Id", this.source.options.underscored)
//this.identifier = this.options.foreignKey || Utils._.underscoredIf(this.as + "Id", this.source.options.underscored)
newAttributes[this.identifier] = { type: this.options.keyType || keyType } newAttributes[this.identifier] = { type: this.options.keyType || keyType }
Helpers.addForeignKeyConstraints(newAttributes[this.identifier], this.target, this.source, this.options) Helpers.addForeignKeyConstraints(newAttributes[this.identifier], this.target, this.source, this.options)
Utils._.defaults(this.source.rawAttributes, newAttributes) Utils._.defaults(this.source.rawAttributes, newAttributes)
......
...@@ -700,16 +700,16 @@ module.exports = (function() { ...@@ -700,16 +700,16 @@ module.exports = (function() {
for (var key in hash) { for (var key in hash) {
var value = hash[key] var value = hash[key]
, _key
, _value = null
if(this.isAssociationFilter(key, dao)){ if(this.isAssociationFilter(key, dao)){
key = this.getAssociationFilterColumn(key, dao); _key = key = this.getAssociationFilterColumn(key, dao);
} else { } else {
key = this.quoteIdentifiers(key) _key = this.quoteIdentifiers(key)
} }
//handle qualified key names //handle qualified key names
var _key = key
, _value = null
if (Array.isArray(value)) { if (Array.isArray(value)) {
result.push(this.arrayValue(value, key, _key, dao)) result.push(this.arrayValue(value, key, _key, dao))
......
...@@ -748,8 +748,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -748,8 +748,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
, Item = this.sequelize.define('Item', {'test': DataTypes.STRING}) , Item = this.sequelize.define('Item', {'test': DataTypes.STRING})
, Order = this.sequelize.define('Order', {'position': DataTypes.INTEGER}) , Order = this.sequelize.define('Order', {'position': DataTypes.INTEGER})
User.belongsTo(Item, {'as': 'itemA'}) User.belongsTo(Item, {'as': 'itemA', foreignKey: 'itemA_id'})
User.belongsTo(Item, {'as': 'itemB'}) User.belongsTo(Item, {'as': 'itemB', foreignKey: 'itemB_id'})
User.belongsTo(Order) User.belongsTo(Order)
this.sequelize.sync().done(function() { this.sequelize.sync().done(function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!