Liquibase generates changelog for Decimal-Currency columns every time app starts

Hello

Why is liquibase change data type changelog file being generated every time I start my application? This is happening for all similar columns (and only these columns):

<changeSet id="1" author="tester">
    <modifyDataType columnName="AMOUNT" newDataType="DECIMAL" tableName="MY_TABLE"/>
</changeSet>

Column definition in createTable changelog is:

<column name="AMOUNT" type="DECIMAL">
    <constraints nullable="false"/>
</column>

Field declaration in my entity class:

@CurrencyValue(currency = "Rs", labelPosition = CurrencyLabelPosition.LEFT)
@NotNull
@Column(name = "AMOUNT", nullable = false)
private BigDecimal amount;

This is really irritating. Please help resolve it.

Thank you for reporting the problem! Created issue: https://youtrack.haulmont.com/issue/JST-2470

To get rid of it, try to add precision and scale parameters to your columns, e.g. @Column(name = "AMOUNT", nullable = false, precision = 19, scale = 2)

Now facing similar issue with createIndex when my entity has many-to-one with User entity. Here’s Entity

@JmixEntity
@Table(name = "V_GUARDIAN", indexes = {
        @Index(name = "IDX_GUARDIAN_USER_ID", columnList = "USER_ID")
})
@Entity(name = "Guardian")
public class Guardian extends StandardLongIdEntity {
    private static final long serialVersionUID = 2121035421012305385L;

    @JoinColumn(name = "USER_ID", nullable = false, unique = true)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private User user;
...

On every execution app is generating below changelog:

<changeSet id="1"
           author="sibgo"
           dbms="postgresql">
    <createIndex indexName="IDX_UC_V_GUARDIAN_USER"
                 tableName="V_GUARDIAN"
                 unique="true">
        <column name="USER_ID"/>
    </createIndex>

    <modifySql>
        <append value="where DELETED_DATE is null"/>
    </modifySql>
</changeSet>

Whereas this index is already there in app’s changelog. Removing indexes gives this issue

Thanks for the report, filed an issue: https://youtrack.haulmont.com/issue/JST-2491

1 Like