Migration from version 4.6.1 to 4.6.2 (and following versions) creates error in changelog

We had a changeset defined in XML which worked in version 4.6.1

<changeSet author="tts" id="3-2">
        <addColumn schemaName="" tableName="ITEMS">
            <column name="rotationTemp" type="REAL" valueNumeric="90*rotation"/>
        </addColumn>
        <dropColumn columnName="rotation" tableName="ITEMS"/>
        
        <addColumn schemaName="" tableName="ITEMS">
            <column name="rotation" type="REAL" valueNumeric="rotationTemp"/>
        </addColumn>  
        <dropColumn columnName="rotationTemp" tableName="ITEMS"/>
    </changeSet>

The changeset is used to change the values in column “rotation” in SQLite, creating a new temp column, dropping the old one and recreating the column and filling it with the values from temp column. After migrating to the last verion (4.16.1 at the moment of this post) the changeset stopped working generating the following error:

          liquibase.exception.DatabaseException: [SQLITE_ERROR] SQL error or missing database
         (duplicate column name: rotation) [Failed SQL: (1) CREATE TABLE ITEMS (item_id INTEGER
     CONSTRAINT PK_ITEMS PRIMARY KEY AUTOINCREMENT NOT NULL, x DOUBLE(2000000000, 10), y 
     DOUBLE(2000000000, 10), rotation FLOAT, itemslayout_id BIGINT(2000000000, 10),
 intetnalId INTEGER, rotationTemp FLOAT(2000000000, 10), rotation FLOAT)]

It seems that liquibase is trying to create a new table with a duplicated “rotation” column instead of just dropping the clumn and adding it back, but the table was created in a previous changelog using :


<createTable tableName="ITEMS">
    <column autoIncrement="true" name="item_id" type="INTEGER">
                <constraints primaryKey="true"/>
    </column>
    <column name="x" type="DOUBLE(2000000000, 10) "/>
    <column name="y" type="DOUBLE(2000000000, 10) "/>
    <column name="rotation" type="INTEGER"/>
    <column name="itemslayout_id" type="BIGINT(2000000000, 10)"/>
    <column name="intetnalId" type="INTEGER"/>
</createTable>

We rolled back liquibase library progressively and we realized that the error starts from version 4.6.2 but it persists till last version. We rolled back to 4.6.1 but we are stuck to this old version and unable to update. Software is currently in production so it wuold be hard to re-write the changelog. Is there a way to avoid this error or should I report an issue on GitHub?

Bests, Dario

To integrate my explanation, is the addColumn instruction which generate the error.
Intead of adding the column it creates a CREATE table sql query with duplicated column name.

Hello @lordBerisha Liquibase 4.6.2 is not yet available, the latest version is 4.6.1. Could you please let us know what Liquibase and database version are you using?

If you are facing this issue with the latest version I highly recommend you report it on Github.

Thanks for the answer, but according to https://github.com/liquibase/liquibase/releases last version is currently 4.16.1 and 4.6.2 was released on 01 Dec 2021,

Hi @lordBerisha - There seems to be some confusion here and I think I can clear it up. The subject of your post seems to have at least one typo in it.

Migration from version 4.61 to 4.6.2 (and following versions) creates error in changelog

There is no version 4.61, and as you stated, 4.6.2 was released last year. I think @raul.balestra assumed you were speaking of versions 4.16.1 and 4.16.2 but continued with a similar typo in his response. Can you please clarify? Are you asking about the older 4.6 versions or the current 4.16 versions?

My bad! Sorry for the typo. I will try to be more clear.
The problem started when we updated from 4.6.1 to 4.16.1 , then we rolled back to provious versions and realized that the error is present in every release starting from 4.6.2.
I reported the issue which is now under revision.

Thanks!

1 Like

Thanks for clarifying! :slight_smile: