Examples of SchemaChange


Examples of org.databene.mad4db.cmd.SchemaChange

  public void testColumnsRemovedAddedAndReordered() {
    // given a table in which the the first column (col1) is removed,
    // col2 and col3 swapped and a new column (col4) appended
    DBTable table1 = createTableWithColumns("tbl", "col1", "col2", "col3");
    DBTable table2 = createTableWithColumns("tbl", "col3", "col2", "col4");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a ColumnOrderChange
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.EXTENSION, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

  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);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.RESTRICTION, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

  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
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.EASE, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

    // 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);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.RESTRICTION, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

  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);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.RESTRICTION, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

  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
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.EASE, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

    // 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);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.RESTRICTION, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

    // given a table to which a foreign key was added
    DBTable target = createTableWithColumns("target", 2);
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table2, new String[] { "col1" }, target, new String[] { "col1" });
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key creation
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.RESTRICTION, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

    // given a table from which a foreign key constraint was removed
    DBTable target = createTableWithColumns("target", 2);
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table1, new String[] { "col1" }, target, new String[] { "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 foreign key deletion
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.EASE, schemaChange);
View Full Code Here

Examples of org.databene.mad4db.cmd.SchemaChange

    DBTable target = createTableWithColumns("target", 2);
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table1, new String[] { "col1" }, target, new String[] { "col1" });
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table2, new String[] { "col2" }, target, new String[] { "col2" });
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key creation
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(TableChange.class, DBTable.class, "tbl", ChangeSeverity.RESTRICTION, 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.