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

Commit c2bba55d by Sascha Depold

removed duplicated foreign keys

1 parent b8a548a5
Showing with 3 additions and 0 deletions
......@@ -166,6 +166,7 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o
// start - overwrite the association of the before defined hasOne or hasMany relation, to fit the belongsTo foreign keys
var Factory = new require("./Factory").Factory(Sequelize, sequelize)
if(backAssociation.type == 'hasMany') {
delete _table.prototype[Sequelize.Helper.SQL.addPrefix('get', backAssociation.name)]
delete _table.prototype[Sequelize.Helper.SQL.addPrefix('set', backAssociation.name)]
......@@ -175,6 +176,8 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o
delete _table.prototype[Sequelize.Helper.SQL.addPrefix('set', backAssociation.name)]
Factory.addOneToOneMethods(_table, table, assocName, backAssociation.name)
}
backAssociation.name = assocName
// end - overwrite the association of the before defined hasOne or hasMany relation, to fit the belongsTo foreign keys
table.associations.push({ name: assocName, table: _table, type: 'belongsTo' })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!