Package org.databene.mad4db.cmd

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


    // 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

  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

  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

    // 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

    // 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

    // 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

    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

  public void testCheckCreated() {
    // given a table to which a check constraint was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBCheckConstraint("check1", false, table2, "col1 > 0");
    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(
View Full Code Here

  public void testCheckDeleted() {
    // given a table to which a check constraint was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBCheckConstraint("check1", false, table1, "col1 > 0");
    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 creation
    System.out.println(schemaChange);
    List<StructuralChange<?>> tableChanges = assertSingleSubChangeAndGetItsSubChanges(
View Full Code Here

TOP

Related Classes of org.databene.mad4db.cmd.SchemaChange

Copyright © 2018 www.massapicom. 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.