Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Liquibase properties which where not compatible with MySQL #3271

Merged

Conversation

Coduz
Copy link
Contributor

@Coduz Coduz commented Mar 9, 2021

This PR fixes Liquibase properties for MySQL which are currently not compatible

Related Issue
None

Description of the solution adopted
For some reasons MySQL database was replacing the CURRENT_TIMESTAMP(3) invocation with NOW() which makes defintions like:

created_on TIMESTAMP(3) DEFAULT NOW()

result the following error:

Caused by: liquibase.exception.DatabaseException: (conn=9) Invalid default value for 'created_on' [Failed SQL: (1067) CREATE TABLE kapuadb.athz_domain (scope_id BIGINT unsigned NULL, id BIGINT unsigned AUTO_INCREMENT NOT NULL, created_on timestamp(3) DEFAULT NOW() NOT NULL, created_by BIGINT unsigned NOT NULL, name VARCHAR(255) NOT NULL, serviceName VARCHAR(1023) NOT NULL, CONSTRAINT PK_ATHZ_DOMAIN PRIMARY KEY (id), UNIQUE (name))]

Replacing CURRENT_TIMESTAMP(3) with NOW(3) makes everything work as expected in MySQL.

Screenshots
None

Any side note on the changes made
Since H2 works fine with NOW(), CURRENT_TIMESTAMP() and CURRENT_TIMESTAMP(3) it has been left using CURRENT_TIMESTAMP(3)

@Coduz Coduz added the Bug This is a bug or an unexpected behaviour. Fix it! label Mar 9, 2021
@Coduz Coduz requested a review from lorthirk March 9, 2021 16:10
@Coduz Coduz force-pushed the fix-liquibaseCurrentTimestampPropertyMysql branch from 6390e51 to 58d588e Compare March 9, 2021 16:20
@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #3271 (32cc916) into develop (f6ac4d3) will decrease coverage by 7.87%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3271      +/-   ##
=============================================
- Coverage      49.32%   41.45%   -7.88%     
+ Complexity       762      745      -17     
=============================================
  Files           1455     1455              
  Lines          29749    29749              
  Branches        2498     2498              
=============================================
- Hits           14675    12333    -2342     
- Misses         14244    16785    +2541     
+ Partials         830      631     -199     
Impacted Files Coverage Δ Complexity Δ
...pse/kapua/kura/simulator/GatewayConfiguration.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...a/kura/simulator/birth/BirthCertificateModule.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...pua/service/account/internal/AccountQueryImpl.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...ua/service/datastore/internal/schema/Metadata.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...ervice/account/internal/AccountListResultImpl.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
.../service/datastore/internal/model/DataIndexBy.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...device/call/message/kura/data/KuraDataMessage.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-2.00%)
...device/call/message/kura/data/KuraDataPayload.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
...datastore/internal/model/DatastoreMessageImpl.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...atastore/internal/model/metric/MetricsIndexBy.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
... and 107 more

@Coduz Coduz force-pushed the fix-liquibaseCurrentTimestampPropertyMysql branch 2 times, most recently from 2a8cd70 to 8c0746b Compare March 10, 2021 12:24
Signed-off-by: Alberto Codutti <alberto.codutti@eurotech.com>
@Coduz Coduz force-pushed the fix-liquibaseCurrentTimestampPropertyMysql branch from 8c0746b to 32cc916 Compare March 12, 2021 08:39
@Coduz Coduz merged commit 874d57c into eclipse-kapua:develop Mar 12, 2021
@Coduz Coduz deleted the fix-liquibaseCurrentTimestampPropertyMysql branch March 12, 2021 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant