String foreignKeyColumn = record.getValue(KeyColumnUsage.COLUMN_NAME);
String foreignKeyTableName = record.getValue(ReferentialConstraints.TABLE_NAME);
String referencedKey = record.getValue(ReferentialConstraints.UNIQUE_CONSTRAINT_NAME);
String referencedTableName = record.getValue(ReferentialConstraints.REFERENCED_TABLE_NAME);
TableDefinition foreignKeyTable = getTable(foreignKeySchema, foreignKeyTableName);
if (foreignKeyTable != null) {
ColumnDefinition column = foreignKeyTable.getColumn(foreignKeyColumn);
String key = getKeyName(referencedTableName, referencedKey);
relations.addForeignKey(foreignKey, key, column, uniqueKeySchema);
}
}