String foreignKey = record.getValue(KEY_COLUMN_USAGE.CONSTRAINT_NAME);
String foreignKeyTable = record.getValue(KEY_COLUMN_USAGE.TABLE_NAME);
String foreignKeyColumn = record.getValue(KEY_COLUMN_USAGE.COLUMN_NAME);
String uniqueKey = record.getValue(REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_NAME);
TableDefinition referencingTable = getTable(foreignKeySchema, foreignKeyTable);
if (referencingTable != null) {
ColumnDefinition referencingColumn = referencingTable.getColumn(foreignKeyColumn);
relations.addForeignKey(foreignKey, uniqueKey, referencingColumn, uniqueKeySchema);
}
}
}