Changlog for change of column length

Hi Team,
I found the Studio will generate two changesets for change of column length , they are dropColumn and addColumn ,see following:

<changeSet id="1" author="skdatta">
        <dropColumn columnName="FILE_REF" tableName="SKDATTA_ATTACHMENT"/>
    </changeSet>
    <changeSet id="2" author="skdatta">
        <addColumn tableName="SKDATTA_ATTACHMENT">
            <column name="FILE_REF" type="VARCHAR(2000)"/>
        </addColumn>
    </changeSet>

If apply the changelog ,the data of the column will lost.
Is it expected behavior?

Regards,
Ray

1 Like

The changelog generator does the same when renaming a column - even if the type does not change at all.

  1. dropping the column
  2. recreate the column

This happened during a migration when migrating to Jmix 1.1. A user entity property was renamed from enabled to active, so all enabled users had become inactive since the default value of a boolean column is false. Thus I could not even fix it with the back-office because the admin user was inactive as well.

@lugreen What I did was manually changing the generated changelog manually before executing and committing.

Hi @bank ,
I believe I must manually change the changelog as you did .
Just I think Studio should generate safer changelogs.

For changing column length, I used modifyDataType:

<modifyDataType
                columnName="file_ref"
                newDataType="varchar(2000)"
                tableName="skdatta_attachment"/>

@lugreen I just wanted to share my experience. I would love to see some improvement on the changelog generation in the future.

1 Like

Hi @lugreen
Thank you for the suggestion, we’ll consider it.
Created an issue.

2 Likes