Examples of DBPrimaryKeyConstraint


Examples of org.databene.jdbacl.model.DBPrimaryKeyConstraint

    out.println("    <td>null</td>");
    out.println("    <td>default</td>");
    out.println("    <td>PK</td>");
    out.println("    <td>FK</td>");
    out.println("  </tr>");
    DBPrimaryKeyConstraint pk = table.getPrimaryKeyConstraint();
    for (DBColumn column : table.getColumns()) {
      String style = componentChangeStyle(column, tableChange);
      out.println("  <tr " + (style != null ? "class='" + style + "'" : null) + ">");
      out.println("    <td>" + column.getName() + "</td>");
      out.println("    <td>" + SQLUtil.renderColumnTypeWithSize(column) + "</td>");
      out.println("    <td>" + (column.isNullable() ? "" : "NOT NULL") + "</td>");
      out.println("    <td>" + (column.getDefaultValue() != null ? column.getDefaultValue() : "") + "</td>");
      out.println("    <td>" + (pk != null && ArrayUtil.contains(column.getName(), pk.getColumnNames()) ? "PK" : "") + "</td>");
      DBForeignKeyConstraint fk = column.getForeignKeyConstraint();
      out.println("    <td>" + (fk != null ? "FK --> " + linkFor(fk.getRefereeTable(), tableFile(table, context)) : "") + "</td>");
      out.println("  </tr>");
    }
    out.println("  </table>");
View Full Code Here

Examples of org.databene.jdbacl.model.DBPrimaryKeyConstraint

  }

  private void exportConstraints(DBTable table, TableChange tableChange, FilePrintWriter out) {
    HtmlReportUtil.startModule("Constraints", out);
    out.println("  <table>");
    DBPrimaryKeyConstraint pk = table.getPrimaryKeyConstraint();
    if (pk != null) {
      String style = componentChangeStyle(pk, tableChange);
      out.println("  <tr " + (style != null ? "class='" + style + "'" : null) + ">");
      out.println("    <td>" + pk.getObjectType() + " " + pk.toString() + "</td>");
      out.println("  </tr>");
    }
    for (DBTableComponent component : table.getCheckConstraints()) {
      String style = componentChangeStyle(component, tableChange);
      out.println("  <tr " + (style != null ? "class='" + style + "'" : null) + ">");
View Full Code Here

Examples of org.databene.jdbacl.model.DBPrimaryKeyConstraint

  @Test
  public void testPKCreated() {
    // given a table to which a primary key was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table2, "pk1", false, "col1");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be an primary key creation creation
    System.out.println(schemaChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBPrimaryKeyConstraint

 
  @Test
  public void testPKDeleted() {
    // given a table from which a primary key was deleted
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table1, "pk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a ConstraintDeletion
View Full Code Here

Examples of org.databene.jdbacl.model.DBPrimaryKeyConstraint

 
  @Test
  public void testPKOnDifferentColumn() {
    // given a table of which a PK was reassigned to another column
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table1, "pk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table2, "pk1", false, "col2");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a ConstraintDeletion and a PrimaryKeyCreation
    System.out.println(schemaChange);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.