String foreignKey = record.getValue("fk_name", String.class);
String foreignKeyTable = record.getValue("fktable_name", String.class);
String foreignKeyColumn = record.getValue("fkcolumn_name", String.class);
String uniqueKey = record.getValue("pk_name", String.class);
TableDefinition referencingTable = getTable(foreignKeySchema, foreignKeyTable);
if (referencingTable != null) {
// [#986] Add the table name as a namespace prefix to the key
// name. In Postgres, foreign key names are only unique per table
ColumnDefinition referencingColumn = referencingTable.getColumn(foreignKeyColumn);
relations.addForeignKey(foreignKeyTable + "__" + foreignKey, uniqueKey, referencingColumn, uniqueKeySchema);
}
}
}