Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Ensure all database timestamps are stored and handled as UTC #198

@mojtaba-esk

Description

@mojtaba-esk

Problem Description

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

  1. Review Database Schema: Check the column types used for all timestamp fields (e.g., created_at, updated_at, deleted_at) across all tables.
  2. 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).
  3. 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.
  4. Verify GORM Configuration: Double-check if any specific GORM or database driver configurations related to timezones need adjustment.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions