[ 
https://issues.apache.org/jira/browse/CAY-2694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17372061#comment-17372061
 ] 

Nikita Timofeev edited comment on CAY-2694 at 6/30/21, 3:05 PM:
----------------------------------------------------------------

[~andrus] yep, there was a problem with a 5.x driver, it doesn't provide any 
information at all. Patched this too, precision will be set to 0 in that case.

[https://github.com/apache/cayenne/commit/e4cf402cff93193c8e5ac42276307abbe4585cc1]


was (Author: ntimofeev):
[~andrus] yep, there was a problem with a 5.x driver, it doesn't provide any 
information at all. Patched this too, precision will set to 0 in that case.

https://github.com/apache/cayenne/commit/e4cf402cff93193c8e5ac42276307abbe4585cc1

> Precision issues with reverse / forward engineering of time types on MySQL
> --------------------------------------------------------------------------
>
>                 Key: CAY-2694
>                 URL: https://issues.apache.org/jira/browse/CAY-2694
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.1
>         Environment: MySQL 5.7.24, Java 1.8, Cayenne 4.1
>            Reporter: Andrus Adamchik
>            Assignee: Nikita Timofeev
>            Priority: Major
>             Fix For: 4.2.M3, 4.2.B1
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> There is a number of issues with reverse and forward engineering of 
> time-related types on MySQL. Not sure if this affects other databases.
> h2. Background
> Per https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html TIME, 
> TIMESTAMP and DATETIME native types can be specified either without a numeric 
> parameter (indicating truncation to whole seconds) or with a single numeric 
> parameter (indicating the number of fractional digits). So "TIME" means whole 
> seconds precision, "TIME(3)" means millisecond precision, "TIME(6)" - 
> microsecond precision.
> h2. Reverse Engineering
> Regardless of precision, Cayenne reverse-engineers the above 3 types to 
> DbAttributes with "maxlength" of "19" and no "scale". Expected - empty 
> "maxlength" and "scale" matching the precision of the column (e.g. none, 3, 6 
> for the example above).
> h2. Forward Engineering
> Currently "maxlength" is included in the generated SQL (e.g. "TIME(19)"), 
> causing DB errors. But even if there were no errors (if it was in the 
> acceptable range), that would still generate invalid column definitions. 
> Expected - "maxlength" must be ignored, and "scale" used if present (e.g. 
> "TIME", "TIME(3)", etc.) 
> Forward engineering is particularly important for Bootique users who are 
> relying on Cayenne for schema generation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to