private String getOneFKasString(KForeignKey fk) { String quote = QUOTE(); return dbSpec.getCommand( "FOREIGN KEY ({fkField}) REFERENCES {referencesTable}({referencesField})", quote + fk.getFkField() + quote, quote + fk.getReferencesTable() + quote, quote + fk.getReferencesField() + quote); }
private List<KForeignKey> getForeignKeys(KObject instance, String tableName) { List<KForeignKey> foreignKeys = new ArrayList<>(); for (KConstraint constraint : instance.getConstraints()) { if (constraint.getForeignKey() != null) { KForeignKey fk = constraint.getForeignKey(); fk.setTableName(tableName); foreignKeys.add(fk); } } return foreignKeys; }