diff --git a/lib/datasource.js b/lib/datasource.js index 9eed0d47..c0f4d070 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -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; }