Examples of DBNonUniqueIndex


Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @Test
  public void testIndexCreated() {
    // given a table of which an index was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBNonUniqueIndex("idx", true, table2, "col1");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be an index creation
    System.out.println(schemaChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

 
  @Test
  public void testIndexDeleted() {
    // given a table of which an index was deleted
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBNonUniqueIndex("idx", true, table1, "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 an index deletion
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  }
 
  public void testIndexOnDifferentColumn() {
    // given a table of which an index was redefined to another column
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBNonUniqueIndex("idx", true, table1, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBNonUniqueIndex("idx", true, table1, "col2");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be an index deletion and an index creation
    System.out.println(schemaChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @Test
  public void testUnchanged() {
    // given a table of which the index has not changed
    DBTable table = createTableWithColumns("tbl", 3);
    DBIndex index1 = new DBNonUniqueIndex("idx", true, table, "col1");
    DBIndex index2 = new DBNonUniqueIndex("idx", true, table, "col1");
    // when performing a comparison
    TableChange tableChange = new TableChange(table, null);
    new IndexComparator(new ComparisonConfig("db1", "db2", null)).compareObjects(index1, index2, tableChange);
    // then the result must be empty
    System.out.println(tableChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @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
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @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
    System.out.println(tableChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @Test
  public void testColumnOrderChanged() {
    // given a table with an index of which the column order changed
    DBTable table = createTableWithColumns("tbl", 2);
    DBIndex index1 = new DBNonUniqueIndex("idx", true, table, "col1", "col2");
    DBIndex index2 = new DBNonUniqueIndex("idx", true, table, "col2", "col1");
    TableChange tableChange = new TableChange(table, null);
    // when performing a comparison
    new IndexComparator(config).compareObjects(index1, index2, tableChange);
    // then the result must be a ColumnOrderChange
    System.out.println(tableChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @Test
  public void testSingleIndexColumnReplaced() {
    // given an index consisting of exactly one column which was replaced in a newer index version
    DBTable table = createTableWithColumns("tbl", 2);
    DBIndex index1 = new DBNonUniqueIndex("idx", true, table, "col1");
    DBIndex index2 = new DBNonUniqueIndex("idx", true, table, "col2");
    TableChange tableChange = new TableChange(table, null);
    // when performing a comparison
    new IndexComparator(config).compareObjects(index1, index2, tableChange);
    // then the result must be deletion of the former index version and creation of the new one
    System.out.println(tableChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

  @Test
  public void testAllIndexColumnsReplaced() {
    // given an index consisting of two columns which are replaced in a newer index version
    DBTable table = createTableWithColumns("tbl", 4);
    DBIndex index1 = new DBNonUniqueIndex("idx", true, table, "col1", "col2");
    DBIndex index2 = new DBNonUniqueIndex("idx", true, table, "col3", "col4");
    TableChange tableChange = new TableChange(table, null);
    // when performing a comparison
    new IndexComparator(config).compareObjects(index1, index2, tableChange);
    // then the result must be deletion of the former index version and creation of the new one
    System.out.println(tableChange);
View Full Code Here

Examples of org.databene.jdbacl.model.DBNonUniqueIndex

 
  @Test
  public void testIndexColumnAdded() {
    // given a tbale with an index to which one more column has been added
    DBTable table = createTableWithColumns("tbl", 2);
    DBIndex index1 = new DBNonUniqueIndex("idx", true, table, "col1");
    DBIndex index2 = new DBNonUniqueIndex("idx", true, table, "col1", "col2");
    TableChange tableChange = new TableChange(table, null);
    // when performing a comparison
    new IndexComparator(config).compareObjects(index1, index2, tableChange);
    // then the result must be a ColumnsAddition
    System.out.println(tableChange);
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.