Examples of DBUniqueConstraint


Examples of org.databene.jdbacl.model.DBUniqueConstraint

  public void compare(Collection<DBUniqueConstraint> uks1, Collection<DBUniqueConstraint> uks2, TableChange tableChange) {
    for (DBUniqueConstraint uk1 : uks1) {
      // search an analogous uk in the second table
      String[] colNames1 = uk1.getColumnNames();
      DBUniqueConstraint uk2 = null;
      for (DBUniqueConstraint tmp : uks2) {
        String[] colNames2 = tmp.getColumnNames();
        if (Arrays.equals(colNames2, colNames1)) {
          uk2 = tmp;
          break; // identical uk was found
View Full Code Here

Examples of org.databene.jdbacl.model.DBUniqueConstraint

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

Examples of org.databene.jdbacl.model.DBUniqueConstraint

 
  @Test
  public void testUKDeleted() {
    // given a table from which a unique key was deleted
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table1, "uk1", 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 constraint deletion
View Full Code Here

Examples of org.databene.jdbacl.model.DBUniqueConstraint

 
  @Test
  public void testUKOnDifferentColumn() {
    // given a table of which a unique key was reassigned to another column
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table1, "uk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table2, "uk1", 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 UniqueConstraintCreation
    System.out.println(schemaChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBUniqueConstraint

  @Test
  public void testIndexMadeUnique() {
    // given an index which only changed by becoming unique
    DBTable table = createTableWithColumns("tbl", 3);
    DBIndex index1 = new DBNonUniqueIndex("idx", true, table, "col1");
    DBIndex index2 = new DBUniqueIndex("idx", true, new DBUniqueConstraint(table, "uk1", false, "col1"));
    TableChange tableChange = new TableChange(table, null);
    // when performing a comparison
    new IndexComparator(config).compareObjects(index1, index2, tableChange);
    // then the result must be an IndexUniquenessChange
    System.out.println(tableChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBUniqueConstraint

  @Test
  public void testIndexMadeNonUnique() {
    // given an index which was unique before but is not now
    DBTable table = createTableWithColumns("tbl", 3);
    DBIndex index1 = new DBUniqueIndex("idx", true, new DBUniqueConstraint(table, "uk1", false, "col1"));
    DBIndex index2 = new DBNonUniqueIndex("idx", true, table, "col1");
    TableChange tableChange = new TableChange(table, null);
    // when performing a comparison
    new IndexComparator(config).compareObjects(index1, index2, tableChange);
    // then the result must be an IndexUniquenessChange
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.