Description
This issue impacts XWiki installed with Mysql servers (probably MariaDB as well, but it could not be 100% confirmed).
Setup of the xwiki instance when the issue will reproduce:
- mysql 8+ or equivalent mariadb version
- XWiki version 11.10+
- the instance's main wiki or some other subwiki needs to exist for a long time and to have been upgraded
- ideally, they need to exist since before mysql 8+/mariadb was used (I think, but it's not 100% sure that this is the cause)
- a new subwiki needs to be created after the move to mysql 8+/mariadb and upgrade of XWiki
Expected result:
The types and tables definitions are the same between the existing subwikis and newly created subwiki.
Actual result:
The date types of the datetime columns (the XWS_VALUE column of xwikidates, or XWD_DATE, XWD_CREATION_DATE and XWD_CONTENT_UPDATE_DATE of xwikidoc, etc) are different between the wikis, in terms of datatype:
- for the tables of existing wikis the type is datetime
- for the tables of the newly created wikis the type is datetime(6).
This impacts the way the milliseconds are handled, the type 'datetime' does not store any milliseconds at all and rounds the value. The type datetime(6) stores the milliseconds with precision of 6 (up to microseconds).
Otherwise put, the issue here is that the datetime type used by hibernate for mysql / mariadb for the "timestamp" hibernate mapping is not migrated automatically to datetime(6) upon upgrade of XWiki.