Discussion:
[Liquibase-user] New Topic: Problems with defaultValueBoolean in MySQL
Liquibase Community Forum
2011-02-10 17:27:06 UTC
Permalink
A new topic, 'Problems with defaultValueBoolean in MySQL', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=1304.new#new

The text of the topic is shown below:

I've the following changeset:
Code:
<changeSet id="add-new-column-changed_default_admin_password" author="smontes">
<comment>Add new column changed_default_admin_password with default value FALSE to configuration table</comment>
<addColumn tableName="configuration">
<column name="changed_default_admin_password" type="BOOLEAN" />
</addColumn>
<addDefaultValue tableName="configuration" columnName="changed_default_admin_password"
defaultValueBoolean="FALSE" />
<addNotNullConstraint tableName="configuration"
columnName="changed_default_admin_password"
defaultNullValue="FALSE"
columnDataType="BOOLEAN" />
</changeSet>


If I apply the changeset in an empty table, I don't have any problem.
However, if table has already some data and I'm using MySQL I get the following error:
Quote
[INFO] Error setting up or running Liquibase: Migration failed for change set src/main/resources/db.changelog-1.0.xml::add-new-column-changed_default_admin_password::smontes:
Reason: liquibase.exception.DatabaseException: Error executing SQL UPDATE `configuration` SET `changed_default_admin_password` = 'FALSE' WHERE changed_default_admin_password IS NULL:
Caused By: Error executing SQL UPDATE `configuration` SET `changed_default_admin_password` = 'FALSE' WHERE changed_default_admin_password IS NULL:
Caused By: Incorrect integer value: 'FALSE' for column 'changed_default_admin_password' at row 1


LiquiBase is creating the new column as tinyint(1) and then it doesn't accept FALSE as value.

This is only happens in MySQL while in PostgreSQL it's working fine.

Any idea about the possible problem?

Thanks,
Rego

Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.

Loading...