You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Currently, the time.Time fields in our GORM models (e.g., CreatedAt, UpdatedAt in gorm.Model) might be stored based on the application server's local time, depending on the underlying database column types and driver behavior. This can lead to ambiguity and potential bugs if application servers or the database run in different timezones or if timezone settings change.
Proposed Solution
To ensure consistency and prevent timezone-related issues, we should standardize on storing all timestamp information in the database as UTC.
Tasks
Review Database Schema: Check the column types used for all timestamp fields (e.g., created_at, updated_at, deleted_at) across all tables.
Update Column Types: If necessary, create and apply database migrations to change timestamp columns to timezone-aware types that normalize to UTC (e.g., TIMESTAMP WITH TIME ZONE / TIMESTAMPTZ in PostgreSQL).
Review Application Logic: Ensure any application-level code that reads or writes timestamps correctly handles the conversion to/from UTC if needed, especially if displaying times in user-specific timezones.
Verify GORM Configuration: Double-check if any specific GORM or database driver configurations related to timezones need adjustment.
Problem Description
Currently, the
time.Timefields in our GORM models (e.g.,CreatedAt,UpdatedAtingorm.Model) might be stored based on the application server's local time, depending on the underlying database column types and driver behavior. This can lead to ambiguity and potential bugs if application servers or the database run in different timezones or if timezone settings change.Proposed Solution
To ensure consistency and prevent timezone-related issues, we should standardize on storing all timestamp information in the database as UTC.
Tasks
created_at,updated_at,deleted_at) across all tables.TIMESTAMP WITH TIME ZONE/TIMESTAMPTZin PostgreSQL).