Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade regression - Liquibase fails to convert BOOLEAN to SMALLINT on existing database #40

Open
ItaiFonio opened this issue Oct 29, 2020 · 5 comments

Comments

@ItaiFonio
Copy link

ItaiFonio commented Oct 29, 2020

I am using

com.sap.db.jdbc
ngdbc
2.6.29


org.liquibase
liquibase-core
4.1.1


org.liquibase.ext
liquibase-hanadb
4.1.1

Running against HANA MDC 1.00.122.16.1520578817

Receiving exception
liquibase.exception.LockException: liquibase.exception.DatabaseException: Error executing SQL UPDATE CONSUMPTION_API.DATABASECHANGELOGLOCK SET LOCKED = TRUE, LOCKEDBY = 'W-R90XGY6Y (10.26.181.46)', LOCKGRANTED = '2020-10-29 12:08:53.983' WHERE ID = 1 AND LOCKED = FALSE: SAP DBTech JDBC: [266] (at 170): inconsistent datatype: BOOLEAN type is not comparable with SMALLINT type.: line 1 col 171 (at pos 170)

Marked regression because Working with

com.sap.db.jdbc
ngdbc
compile


org.liquibase
liquibase-core
3.4.1


org.liquibase.ext
liquibase-hana
3.4.1-sap-02

Please advise

┆Issue is synchronized with this Jira Bug by Unito

@ItaiFonio ItaiFonio changed the title Blocker regression - Liquibase fails to convert BOOLEAN to SMALLINT UPgrade regression - Liquibase fails to convert BOOLEAN to SMALLINT Oct 29, 2020
@ItaiFonio ItaiFonio changed the title UPgrade regression - Liquibase fails to convert BOOLEAN to SMALLINT Upgrade regression - Liquibase fails to convert BOOLEAN to SMALLINT on existing database Oct 29, 2020
@P1ll3P4ll3
Copy link

P1ll3P4ll3 commented May 17, 2021

Hello,
in order to achieve this, we had to implement our own Boolean Type for HANA as subclass of BooleanTypeHana with the methods toDatabaseDataType (return SMALLINT) and isNumericBoolean (always returns true). We had to deregister the Boolean types with DataTypeFactory and registered the necessary Boolean data types again including our own. We are doing this in a subclass of SpringLiquibase.

The reason for this is probably that older HANA versions did not support a BOOLEAN db type. So either a type conversion/migration is required for the corresponding columns or you have to implement a custom data type as explained above.

Best regards,
P1ll3P4ll3

@victorhbv
Copy link

Hello @P1ll3P4ll3,

I am running into the same problem. Is it possible to place here your implementation or give a bit more detailed explanation on that?

Best Regards.

@vigsank
Copy link

vigsank commented Mar 8, 2022

Hello All,

I am running into the same problem now. Any suggestions here would be highly appreciated.

Thanks.

@vigsank
Copy link

vigsank commented Mar 16, 2022

Solution that worked for me:

When I encountered this situation, I dropped the 'Databasechangeloglock' table and restarted Liquibase processes again from start - that recreated the 'Databasechangeloglock' table - this time with compatible column datatype (Boolean).
The server started up successfully after that.

Reference -- liquibase/liquibase#1780 (comment)

@suri882006
Copy link

@P1ll3P4ll3 thanks for your suggestion, this worked us. BooleanTypeHana is subclassed to return 0/1 and the same is registered again through DataTypeFactory by extending SpringLiquibase class

Regards,
Suraj Acharya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants