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

liquibase generates boolean columns only in ibm db2 versions with fixpack version >= 1 #4723

Closed
2 tasks done
haltenwe opened this issue Aug 23, 2023 · 3 comments · Fixed by #4754
Closed
2 tasks done

Comments

@haltenwe
Copy link
Contributor

Search first

  • I searched and no similar issues were found

Description

IBM DB2 supports BOOLEAN type columns as of version 11.1.1.1. We are using IBM DB2 11.5.7.0, Liquibase continues to generate SMALLINT for the columns of type BOOLEAN. In IBM DB2 with a fix pack >= 1, the correct data type is generated by Liquibase.

<changeSet context="create" author="xxx" id="create-table_with_boolean">
	<createTable tableName="TEST_TABLE">
		<column name="ID" type="VARCHAR(36)">
			<constraints nullable="false" primaryKey="true"
				primaryKeyName="TEST_TABLEPK"></constraints>
		</column>
		<column name="NUMBER_INT" type="INT" />
		<column name="NUMBER_SMALLINT" type="SMALLINT" />
		<column name="FLAG" type="BOOLEAN" />
	</createTable>
</changeSet>

Steps To Reproduce

Use the changeset above with two installations of IBM DB2. One of the Installations should have Fixpack 0.

Expected/Desired Behavior

For all versions of IBM DB2 after 11.1.1.1, Liquibase also generates the corresponding database columns of type BOOLEAN for columns that are defined as BOOLEAN in the changesets.

Liquibase Version

4.20.0

Database Vendor & Version

IBM DB2 LUW 11.5.7.0

Liquibase Integration

spring boot

Liquibase Extensions

No response

OS and/or Infrastructure Type/Provider

ubuntu, windows 10

Additional Context

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@haltenwe
Copy link
Contributor Author

The change should by done in liquibase.database.core.DB2Database, rows 38, 39

return getDatabaseMajorVersion() > 11
  || getDatabaseMajorVersion() == 11 && ( getDatabaseMinorVersion() == 1 && fixPack.intValue() >= 1 || getDatabaseMinorVersion() > 1 );

By the way, now it is not possible to override DB2Database (without overriding StandardLockService as well), because in liquibase.lockservice.StandardLockService, row 162, the check database.getClass().isAssignableFrom(DB2Database.class) should be done like DB2Database.class.isAssignableFrom( database.getClass() ).

haltenwe added a commit to haltenwe/liquibase that referenced this issue Aug 24, 2023
Fixes liquibase#4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
@kevin-atx
Copy link
Contributor

@haltenwe - Would you be willing to submit your fix as a PR? If you do so, we'll schedule it for review and integration in the next sprint.

@haltenwe
Copy link
Contributor Author

@kevin-atx I hope I did the PR correctly ;-)

MalloD12 added a commit to haltenwe/liquibase that referenced this issue Aug 31, 2023
MalloD12 pushed a commit that referenced this issue Aug 31, 2023
Fixes #4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
MalloD12 added a commit to haltenwe/liquibase that referenced this issue Sep 15, 2023
MalloD12 pushed a commit that referenced this issue Sep 15, 2023
Fixes #4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
rberezen pushed a commit that referenced this issue Sep 19, 2023
Fixes #4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
filipelautert pushed a commit to haltenwe/liquibase that referenced this issue Oct 2, 2023
Fixes liquibase#4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
filipelautert pushed a commit that referenced this issue Oct 2, 2023
Fixes #4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
filipelautert pushed a commit that referenced this issue Oct 16, 2023
… columns. (patch for #4723) (#4754)

* Update StandardLockService.java

Fix the error: check, that DB2Database is a superclass of the configured implementation 

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>

* Update DB2Database.java

Fixes #4723: check of the version of DB2

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>

* Update init method logic to only check old changelog table format logic when not using a LoggingExecutor.

---------

Signed-off-by: Erich Haltenwanger <erich@haltenwanger.de>
Co-authored-by: Daniel Mallorga <dmallorga@liquibase.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
2 participants