// SQLite mixes up cases from the actual declaration and the
// reference definition! It's possible that a table is declared
// in lower case, and the foreign key in upper case. Hence,
// correct the foreign key
TableDefinition referencingTable = getTable(getSchemata().get(0), foreignKeyTable);
TableDefinition referencedTable = getTable(getSchemata().get(0), record.getValue("table", String.class), true);
if (referencedTable != null) {
String uniqueKey =
"pk_" + referencedTable.getName();
if (referencingTable != null) {
ColumnDefinition referencingColumn = referencingTable.getColumn(foreignKeyColumn);
relations.addForeignKey(foreignKey, uniqueKey, referencingColumn, getSchemata().get(0));
}