JetBrains / JetBrains/Exposed

On MySQL JavaInstantColumnType column uses DATETIME instead of TIMESTAMP

Open
#865 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

Right now, when you have a column initialized using JavaInstantColumnType (or `timestamp()` from exposed-java-time module) it will use `DATETIME` type upon table creation via SchemaUtils if MySQL database is used.

I believe `TIMESTAMP` type from MySQL would be more suitable since it conveys the same meaning as Instant class in java (aka pure time in UTC), while `DATETIME` acts more like LocalDateTime. This behaviour can be kind of misleading and recently resulted in some unexpected issues on our production server (we naturally thought that timestamp() would produce an actual TIMESTAMP and never checked)

I realise that it's probably too late to change it but this detail of implementation at least should be addressed in documentation. Some people could write their own implementations of JavaInstantColumnType which would use TIMESTAMP if they actualy need such behaviour (like we did).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.