Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase : issue with setting boolean default value

Tags:

liquibase

I am trying to add a new field with liquibase

<addColumn tableName="contact_client">
            <column defaultValue="0"
                    defaultValueBoolean="0"
                    name="obsolete"
                    type="boolean"/>
        </addColumn>

But I am getting this error :

liquibase.exception.DatabaseException: Invalid default value for 'obsolete' [Failed SQL: ALTER TABLE myApp.contact_client ADD obsolete BIT(1) DEFAULT 'false' NULL]

How can I pass a default value?

like image 632
thomas Avatar asked May 04 '18 08:05

thomas


1 Answers

Actually, here is the solution for a MySQL database:

<addColumn tableName="contact_client">
    <column defaultValueBoolean="false"
            name="obsolete"
            type="boolean"/>
</addColumn>

I needed to remove the defaultValue property.

like image 56
thomas Avatar answered Sep 23 '22 21:09

thomas