diff --git a/lib/datasource.js b/lib/datasource.js index eb740fbd..0401f7ce 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -426,6 +426,41 @@ DataSource.prototype.discoverForeignKeysSync= function(owner, table) { return null; } +/** + * Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table). + * They are ordered by fkTableOwner, fkTableName, and keySeq. + * + * fkOwner String => foreign key table schema (may be null) + * fkName String => foreign key name (may be null) + * fkTableName String => foreign key table name + * fkColumnName String => foreign key column name + * keySeq short => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key). + * pkOwner String => primary key table schema being imported (may be null) + * pkName String => primary key name (may be null) + * pkTableName String => primary key table name being imported + * pkColumnName String => primary key column name being imported + * + * @param owner + * @param table + * @param cb + */ +DataSource.prototype.discoverExportedForeignKeys= function(owner, table, cb) { + this.freeze(); + if (this.adapter.discoverExportedForeignKeys) { + this.adapter.discoverExportedForeignKeys(owner, table, cb); + } else if (cb) { + cb(); + } +} + +DataSource.prototype.discoverExportedForeignKeysSync= function(owner, table) { + this.freeze(); + if (this.adapter.discoverExportedForeignKeysSync) { + return this.adapter.discoverExportedForeignKeysSync(owner, table); + } + return null; +} + function capitalize(str) { if (!str) { return str;