Skip to content

fix: [#699] database timezone#1060

Merged
hwbrzzl merged 3 commits intov1.15.xfrom
bowen/#699
Jun 5, 2025
Merged

fix: [#699] database timezone#1060
hwbrzzl merged 3 commits intov1.15.xfrom
bowen/#699

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Jun 5, 2025

📑 Description

Closes goravel/goravel#699

Currently, for Timestamps column of Postgres and Sqlserver, 2025-06-05 14:46:29 +08:00 will be saved with 2025-06-05 14:46:29, but when reading, ORM considers that the timezone is UTC, the timezone metadata is missed.

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings June 5, 2025 07:05
@hwbrzzl hwbrzzl requested a review from a team as a code owner June 5, 2025 07:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the default migration stub to generate timezone-aware timestamp columns.

  • Replaces Timestamps() with TimestampsTz() in the migration Up stub
  • No corresponding update in the Down stub for rollback
  • Missing tests to verify timezone-aware behavior
Comments suppressed due to low confidence (2)

database/migration/stubs.go:50

  • Add a migration test to confirm that generated migrations with TimestampsTz() produce timezone-aware timestamp columns in both creation and rollback.
table.TimestampsTz()

database/migration/stubs.go:50

  • The Down stub likely still drops Timestamps(). Update the rollback stub to remove timezone-aware columns, e.g., use a corresponding DropTimestampsTz() or adjust to match TimestampsTz for consistency.
table.TimestampsTz()

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: 95fd998 Previous: 6b6b6a8 Ratio
BenchmarkFile_ReadWrite 361884 ns/op 6040 B/op 93 allocs/op 226806 ns/op 6186 B/op 97 allocs/op 1.60
BenchmarkFile_ReadWrite - ns/op 361884 ns/op 226806 ns/op 1.60

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (v1.15.x@dc39568). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             v1.15.x    #1060   +/-   ##
==========================================
  Coverage           ?   68.78%           
==========================================
  Files              ?      218           
  Lines              ?    18869           
  Branches           ?        0           
==========================================
  Hits               ?    12979           
  Misses             ?     5229           
  Partials           ?      661           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl merged commit b74d50a into v1.15.x Jun 5, 2025
11 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#699 branch June 5, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants