addNotNullConstraint not working in MySQL with boolean values

Description

addNotNullConstraint is not working in MySQL with boolean values when there is already some record stored in table (it works properly with PostgreSQL).

For example if you have the following changeset:
<addNotNullConstraint tableName="configuration"
columnName="changed_default_admin_password"
defaultNullValue="FALSE"
columnDataType="BOOLEAN" />

It tries to execute the next UPDATE sentence:
UPDATE `configuration` SET `changed_default_admin_password` = 'FALSE' WHERE changed_default_admin_password IS NULL

But, the correct one in MySQL should be:
UPDATE `configuration` SET `changed_default_admin_password` = '0' WHERE changed_default_admin_password IS NULL

I'm attaching a patch with a possible fix for this issue.

See forum for more info: http://forum.liquibase.org/#Topic/49382000000032143

Environment

Ubuntu 10.10 i386

Attachments

1
  • 17 Feb 2011, 11:10 AM

Activity

Show:

Manuel Rego Casasnovas January 23, 2012 at 12:59 PM

I've sent a pull request to revert this patch and fix the issue with a different approach:
https://github.com/liquibase/liquibase/pull/23

Manuel Rego Casasnovas January 23, 2012 at 12:30 PM

This patch was wrong, it's breaking the addNotNullConstraint like reported in https://liquibase.jira.com/browse/CORE-1060#icft=CORE-1060

So this issue should be fixed with a different approach.

Fixed

Details

Reporter

Fix versions

Affects versions

Priority

Created February 17, 2011 at 11:10 AM
Updated June 20, 2013 at 3:30 AM
Resolved September 14, 2011 at 5:32 AM