1
votes

I use flyway 4.0, hibernate 5.1.0.Final and 2 databases : postgresql 9.4.1208 and hsqldb 2.3.1 (for test)

We need to supervise database status of our application. I create a SchemaVersionEntity to check database (version of script and status success of last script) entity column success is of type Boolean

We do jpa validation: in flyway postgresql createMetaDataTable success is map to boolean : https://github.com/flyway/flyway/blob/master/flyway-core/src/main/resources/org/flywaydb/core/internal/dbsupport/postgresql/createMetaDataTable.sql

in flyway hsql createMetaDataTable success is map to bit : (boolean exists since v2) https://github.com/flyway/flyway/blob/master/flyway-core/src/main/resources/org/flywaydb/core/internal/dbsupport/hsql/createMetaDataTable.sql

So I get a error:

org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [success] in table [schema_version]; found [bit (Types#BIT)], but expecting [boolean (Types#BOOLEAN)]

What is the best solution ? Modify flyway\flyway-core\src\main\resources\org\flywaydb\core\internal\dbsupport\hsql ?

  "success" BOOLEAN NOT NULL
1
You can customize H2Dialect and use it in Test configuration.Sangram Jadhav

1 Answers

0
votes

You can customize H2Dialect and use it in Test Configuration

public class CustomH2Dialect extends H2Dialect {

    public CustomH2Dialect() {
        super();
        registerColumnType(Types.BOOLEAN, "bit");
    }
}