Search in sources :

Example 6 with PrimaryKeyConstraint

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(")");
}
Also used : UniquenessConstraint(org.openforis.collect.relational.model.UniquenessConstraint) PrimaryKeyConstraint(org.openforis.collect.relational.model.PrimaryKeyConstraint)

Aggregations

PrimaryKeyConstraint (org.openforis.collect.relational.model.PrimaryKeyConstraint)6 UniquenessConstraint (org.openforis.collect.relational.model.UniquenessConstraint)3 Record (org.jooq.Record)2 Column (liquibase.database.structure.Column)1 Index (liquibase.database.structure.Index)1 Table (liquibase.database.structure.Table)1 Column (mondrian.olap.MondrianDef.Column)1 DimensionLink (mondrian.olap.MondrianDef.DimensionLink)1 FactLink (mondrian.olap.MondrianDef.FactLink)1 ForeignKey (mondrian.olap.MondrianDef.ForeignKey)1 ForeignKeyLink (mondrian.olap.MondrianDef.ForeignKeyLink)1 Link (mondrian.olap.MondrianDef.Link)1 NoLink (mondrian.olap.MondrianDef.NoLink)1 PhysicalSchema (mondrian.olap.MondrianDef.PhysicalSchema)1 Table (mondrian.olap.MondrianDef.Table)1 CodeTable (org.openforis.collect.relational.model.CodeTable)1 CodeValueFKColumn (org.openforis.collect.relational.model.CodeValueFKColumn)1 DataColumn (org.openforis.collect.relational.model.DataColumn)1 DataTable (org.openforis.collect.relational.model.DataTable)1 PrimaryKeyColumn (org.openforis.collect.relational.model.PrimaryKeyColumn)1