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

Commit aae77c43 by Mick Hansen

Try to maintain BC

1 parent db597c1d
......@@ -39,7 +39,7 @@ module.exports = (function() {
, 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(this.as + "Id", this.source.options.underscored)
newAttributes[this.identifier] = { type: this.options.keyType || keyType }
Helpers.addForeignKeyConstraints(newAttributes[this.identifier], this.target, this.source, this.options)
Utils._.defaults(this.source.rawAttributes, newAttributes)
......
......@@ -700,16 +700,16 @@ module.exports = (function() {
for (var key in hash) {
var value = hash[key]
, _key
, _value = null
if(this.isAssociationFilter(key, dao)){
key = this.getAssociationFilterColumn(key, dao);
_key = key = this.getAssociationFilterColumn(key, dao);
} else {
key = this.quoteIdentifiers(key)
_key = this.quoteIdentifiers(key)
}
//handle qualified key names
var _key = key
, _value = null
if (Array.isArray(value)) {
result.push(this.arrayValue(value, key, _key, dao))
......
......@@ -748,8 +748,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
, Item = this.sequelize.define('Item', {'test': DataTypes.STRING})
, Order = this.sequelize.define('Order', {'position': DataTypes.INTEGER})
User.belongsTo(Item, {'as': 'itemA'})
User.belongsTo(Item, {'as': 'itemB'})
User.belongsTo(Item, {'as': 'itemA', foreignKey: 'itemA_id'})
User.belongsTo(Item, {'as': 'itemB', foreignKey: 'itemB_id'})
User.belongsTo(Order)
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!