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

fix: EXPOSED-718 Fix timestamp column not storing values in UTC time zone #2386

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

joc-a
Copy link
Collaborator

@joc-a joc-a commented Jan 31, 2025

Description

Summary of the change: Fixed timestamp column not storing values in UTC time zone

Detailed description:

  • Why:
    Instant is in UTC time zone, and the expected behaviour is that the timestamp column should store values in UTC time zone since it is without a user-specified time zone. Using the session or system time zone leads to unexpected behaviour like this.
  • How:
    Created new formatters that use the UTC timezone and used these formatters for timestamp column type.
    In JavaInstantColumnType and KotlinInstantColumnType, I modified the notNullValueToDB function to return the formatted String for MySQL (excluding MariaDB) because there was an issue with MySQL 5 where it implicitly converted the value to the session time zone when storing it and lead to an unexpected behaviour when the value is retrieved.

Type of Change

Please mark the relevant options with an "X":

  • Bug fix
  • New feature
  • Documentation update

Updates/remove existing public API methods:

  • Is breaking change

Affected databases:

  • MariaDB
  • Mysql5
  • Mysql8
  • Oracle
  • Postgres
  • SqlServer
  • H2
  • SQLite

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)
  • All public methods affected by my PR has up to date API docs
  • Documentation for my change is up to date

Related Issues

@joc-a joc-a force-pushed the joc/exposed-718-utc-formatters branch from 26ddb1e to 80edc93 Compare January 31, 2025 12:05
@joc-a joc-a marked this pull request as ready for review January 31, 2025 13:07
@joc-a joc-a requested a review from bog-walk January 31, 2025 13:08
@joc-a joc-a changed the title fix: EXPOSED 718 Fix timestamp column not storing values in UTC time zone fix: EXPOSED-718 Fix timestamp column not storing values in UTC time zone Jan 31, 2025
@joc-a joc-a force-pushed the joc/exposed-718-utc-formatters branch from 80edc93 to ef99411 Compare February 3, 2025 11:54
@joc-a joc-a merged commit 9fc2734 into main Feb 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants