Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upLiquibase inserts wrong default datetime value into MySql #1395
Comments
|
Hi @vaa25-digis Thank you for writing up this descriptive issue with great steps to reproduce. We will add this to our list of issues to process. In the meantime if you have a fix, please create a PR and we will process that as well. |
|
Hi @vaa25-digis, can you simply use |
Environment
Liquibase Version: 4.0.0
Liquibase Integration & Version: spring boot 2.3.2
Liquibase Extension(s) & Version:
Database Vendor & Version: MySql 8.0.15
Operating System Type & Version: Ubuntu 18.04.3
Description
Fail when try to add column with precisioned CURRENT_TIMESTAMP default value
Steps To Reproduce
Run this changelog:
Actual Behavior
Result of execution:
liquibase.exception.DatabaseException: Invalid default value for 'created_at' [Failed SQL: (1067) CREATE TABLE liquibase.test (id INT AUTO_INCREMENT NOT NULL, created_at datetime(3) DEFAULT NOW() NOT NULL, CONSTRAINT PK_TEST PRIMARY KEY (id))]
Expected/Desired Behavior
Apply correct sql :
CREATE TABLE liquibase.test (id INT AUTO_INCREMENT NOT NULL, created_at datetime(3) DEFAULT NOW(3) NOT NULL, CONSTRAINT PK_TEST PRIMARY KEY (id))
Additional Context
dev.mysql.com/doc/refman/8.0/en/date-and-time-type-syntax.html
An optional fsp value in the range from 0 to 6 may be given to specify fractional seconds precision. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0.┆Issue is synchronized with this Jira Bug by Unito