Offline UpdateSQL for mariadb with csv doesn't handle boolean values correctly ?
See original GitHub issueEnvironment
Liquibase Version: 4.11.0
Liquibase Integration & Version: maven
Liquibase Extension(s) & Version:
Database Vendor & Version: MariaDb
Operating System Type & Version:
Infrastructure Type/Provider:
Description
I use maven liquibase plugin to generate SQL from changeset for mariadb.
A couple of changesets use loadUpdateData
with csv data as input.
The table I try to update contains boolean
values, which are declared as 'bit'
in mariadb.
The CSV I have contains 'true'
or 'false'
value for values for these columns.
When I generate the SQL in offline mode with mvn liquibase:updateSQL
, I get insert statement with 'true'
or 'false'
values instead of 1
or 0
.
I had a look at stackoverflow where they say that I should add a column
element with valueBoolean="true"
, but it doesn’t change anything in the offline mode I’m in: I still get 'true'
or 'false'
values for bit column, which are incorrect values.
<loadData encoding="UTF-8"
file="path/to/file.csv"
separator=","
tableName="MY_TABLE">
<!-- specify that values in my_boolean_column should be interpreted as Boolean values -->
<column name="my_boolean_column" type="BOOLEAN" />
</loadData>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<configuration>
<changeLogFile>${liquibase.dir}/changelog-master.xml</changeLogFile>
<url>offline:mariadb?outputLiquibaseSql=true&changeLogFile=${liquibase.offline.dir}/databasechangelog.csv</url>
<migrationSqlOutputFile>${liquibase.offline.dir}/upgrade-toto-${project.version}.sql</migrationSqlOutputFile>
</configuration>
</plugin>
Thank you for your help 😃
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
After searching more and investigating, I found that this was not a bug but a problem between the keyboard and the chair. I did not mention the mapping column in the loadupdatedata with a correct type that should be in the list https://www.liquibase.org/javadoc/liquibase/change/core/LoadDataChange.LOAD_DATA_TYPE.html
liquibase-issue-2951.zip