How to specify a float/decimal value for a column inside an insert in liquibase changelog?

29 views Asked by At

I'm just starting to learn liquidbase, I wrote a changeset with an insert, here's part of it:

databaseChangeLog:
...

- changeset:
  id: "all_types_table"
  changes:
  - createTable:
    tableName: "all_types_table"
    ...
  - insert:
    tableName: all_types_table
    columns:
  - column:
    name: float_column
    valueNumeric: 1.1
    ...

During the migration process, liquibase sets a parameter in JdbcDriver for this column with type double and not float. Same issue with the decimal type.

I tried using 'value' instead of 'valueNumber', adding quotes, and adding the literal 'f' to the number, but nothing worked.

Then I debugged and came to the "liquibase.change.ColumnConfig" class - inside this class the 'valueNumeric' that I specified inside the changelog is parsed. Inside, the NumberFormat.getInstance(locale).parse(value) method is called, which returns either Long or Double.

Is it possible to set the float/decimal parameter using changelog.yaml, without using sql files?

0

There are 0 answers