Fix the id column name

This commit is contained in:
Raymond Feng 2013-05-22 12:17:14 -07:00
parent 5b32141e31
commit 31473d3add
1 changed files with 9 additions and 2 deletions

View File

@ -399,9 +399,16 @@ DataSource.prototype.discoverSchema = function (owner, table, cb) {
var foreignKeys = results[2];
foreignKeys.forEach(function(fk) {
fks[fk.fkColumnName] = fk.keySeq;
fks[fk.fkColumnName] = {
keySeq: fk.keySeq,
owner: fk.pkOwner,
tableName: fk.pkTableName,
columnName: fk.pkColumnName
};
});
console.log(fks);
if (!columns) {
cb && cb();
return;
@ -542,7 +549,7 @@ DataSource.prototype.getIDColumnName = function(modelName) {
}
});
if(props.id) {
return 'id';
return self.columnName(modelName, 'id');
}
return null;
}