Liquibase fills large numbers inaccurately with a table from the generated changelog
I have currently switched to linibase and used the generateChangelog command to generate my tables and data for installation purposes. However, after running changesets on a clean database, the data was not as expected. Ive created a small example to illustrate the problem. The following MySQL table was used
CREATE TABLE `test_table` (
`value1` bigint(20) DEFAULT NULL,
`value2` bigint(20) DEFAULT NULL,
`value3` bigint(20) DEFAULT NULL,
`value4` bigint(20) DEFAULT NULL,
`value5` bigint(20) DEFAULT NULL,
`value6` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
The table contained the following entries:
mysql> select * from test_table;
+--------------------+--------------------+--------------------+--------------------+---------------------+---------------------+
| value1 | value2 | value3 | value4 | value5 | value6 |
+--------------------+--------------------+--------------------+--------------------+---------------------+---------------------+
| 900000000000000000 | 900000000000000001 | 999999999999999900 | 999999999999999999 | 1000000000000000001 | 9223372036854775807 |
+--------------------+--------------------+--------------------+--------------------+---------------------+---------------------+
1 row in set (0.00 sec)
Using the Liquibase generateChangelog command generated the following commands:
<changeSet author="support (generated)" id="1412248645392-1">
<createTable tableName="test_table">
<column name="value1" type="BIGINT(19)"/>
<column name="value2" type="BIGINT(19)"/>
<column name="value3" type="BIGINT(19)"/>
<column name="value4" type="BIGINT(19)"/>
<column name="value5" type="BIGINT(19)"/>
<column name="value6" type="BIGINT(19)"/>
</createTable>
</changeSet>
<changeSet author="support (generated)" id="1412248645392-2">
<insert tableName="test_table">
<column name="value1" valueNumeric="900000000000000000"/>
<column name="value2" valueNumeric="900000000000000001"/>
<column name="value3" valueNumeric="999999999999999900"/>
<column name="value4" valueNumeric="999999999999999999"/>
<column name="value5" valueNumeric="1000000000000000001"/>
<column name="value6" valueNumeric="9223372036854775807"/>
</insert>
</changeSet>
However, restoring those changesets to an empty database incorrectly populated the table as follows:
mysql> select * from test_table;
+--------------------+--------------------+--------------------+---------------------+---------------------+---------------------+
| value1 | value2 | value3 | value4 | value5 | value6 |
+--------------------+--------------------+--------------------+---------------------+---------------------+---------------------+
| 900000000000000000 | 900000000000000000 | 999999999999999872 | 1000000000000000000 | 1000000000000000000 | 9223372036854775807 |
+--------------------+--------------------+--------------------+---------------------+---------------------+---------------------+
1 row in set (0.01 sec)
Can anyone have an explanation why the values are wrong? I am using MySQL version 5.5 and Liquibase 3.2.2 Core.
Edited: The workaround now seems to populate the data by replacing "valueNumeric" with "value" in the column tags, however this does not explain why valueNumeric does not work as expected.
source to share
No one has answered this question yet
Check out similar questions: