use of org.openforis.collect.relational.model.PrimaryKeyConstraint in project collect by openforis.
the class RDBSchemaPrintTask method writeForeignKeyConstraint.
private void writeForeignKeyConstraint(ReferentialConstraint fk) throws IOException {
writer.write(" FOREIGN KEY ");
writer.write('(');
writeColumnNameSet(fk.getColumns());
writer.write(')');
writer.write(" REFERENCES ");
UniquenessConstraint referencedKey = fk.getReferencedKey();
Table<?> referencedTable = referencedKey.getTable();
writer.write(getQualifiedTableName(referencedTable));
PrimaryKeyConstraint referencedTablePK = referencedTable.getPrimaryKeyConstraint();
writer.write('(');
writeColumnNameSet(referencedTablePK.getColumns());
writer.write(")");
}
Aggregations