忽略<changeset>中的<adddefaultvalue>,是否可以在比较时忽略列的默认值?

时间:2018-07-30 11:30:18

标签: java database liquibase

我已经使用Java创建了一个Liquibase应用程序,其中我将两个diff数据库与那里的表进行了比较,但是我想忽略它,所以有可能忽略列的默认值,而如果比较则该怎么做呢?

private void generateResult( Database srcDatabase, Database referenceDatabase ) throws LiquibaseException
{
    Set<Class<? extends DatabaseObject>> typesToInclude = new HashSet<>();
    typesToInclude.add( Table.class );
    typesToInclude.add( Column.class );
    typesToInclude.add( PrimaryKey.class );
    typesToInclude.add( View.class );
    typesToInclude.add( ForeignKey.class );
    typesToInclude.add( UniqueConstraint.class );
    typesToInclude.add( Sequence.class );

    final CompareControl compareControl = new CompareControl( typesToInclude );
    compareControl.addSuppressedField( Table.class, "remarks" );
    compareControl.addSuppressedField( Column.class, "remarks" );
    compareControl.addSuppressedField( Column.class, "certainDataType" );
    compareControl.addSuppressedField( Column.class, "autoIncrementInformation" );
    compareControl.addSuppressedField( ForeignKey.class, "deleteRule" );
    compareControl.addSuppressedField( ForeignKey.class, "updateRule" );
    compareControl.addSuppressedField( Index.class, "unique" );
    final DiffResult diffResult = DiffGeneratorFactory.getInstance().compare(
        srcDatabase, referenceDatabase,
        compareControl );

    DiffToChangeLog diffToChangeLog = new DiffToChangeLog( diffResult, new DiffOutputControl( true, true, true,
        null ) );


}

0 个答案:

没有答案