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


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"/>

Column definition in createTable changelog is:

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

Field declaration in my entity class:

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

This is really irritating. Please help resolve it.

Thank you for reporting the problem! Created issue:

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

@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"
    <createIndex indexName="IDX_UC_V_GUARDIAN_USER"
        <column name="USER_ID"/>

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

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

Thanks for the report, filed an issue:

1 Like