[PR #4447] fix: add timezone support to PostgreSQL timestamps in Drizzle schema … #5392

Open
opened 2026-03-13 12:21:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4447
Author: @JuanPabloGilA
Created: 9/4/2025
Status: 🔄 Open

Base: canaryHead: canary


📝 Commits (1)

  • 04e14fb fix: add timezone support to PostgreSQL timestamps in Drizzle schema generator

📊 Changes

4 files changed (+74 additions, -38 deletions)

View changed files

📝 packages/cli/src/generators/drizzle.ts (+1 -1)
📝 packages/cli/test/__snapshots__/auth-schema-number-id.txt (+24 -12)
📝 packages/cli/test/__snapshots__/auth-schema-pg-passkey.txt (+25 -13)
📝 packages/cli/test/__snapshots__/auth-schema.txt (+24 -12)

📄 Description

  • Update PostgreSQL timestamp generation to include { withTimezone: true }
  • This ensures proper timezone handling for PostgreSQL databases
  • Update test snapshots to reflect the new timestamp format

References:
Preview Pr's
https://github.com/better-auth/better-auth/pull/4440
https://github.com/better-auth/better-auth/pull/3477

Open issues:
https://github.com/better-auth/better-auth/issues/3461


Summary by cubic

Make PostgreSQL timestamps timezone-aware in the Drizzle schema generator by using timestamp(name, { withTimezone: true }). This fixes incorrect time handling and updates generated snapshots for all timestamp fields.

  • Migration
    • Regenerate the schema and run a migration to convert affected PostgreSQL columns to timestamp with time zone.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4447 **Author:** [@JuanPabloGilA](https://github.com/JuanPabloGilA) **Created:** 9/4/2025 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (1) - [`04e14fb`](https://github.com/better-auth/better-auth/commit/04e14fb6870bacc5827e8984c98da8e26694f44e) fix: add timezone support to PostgreSQL timestamps in Drizzle schema generator ### 📊 Changes **4 files changed** (+74 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/generators/drizzle.ts` (+1 -1) 📝 `packages/cli/test/__snapshots__/auth-schema-number-id.txt` (+24 -12) 📝 `packages/cli/test/__snapshots__/auth-schema-pg-passkey.txt` (+25 -13) 📝 `packages/cli/test/__snapshots__/auth-schema.txt` (+24 -12) </details> ### 📄 Description - Update PostgreSQL timestamp generation to include { withTimezone: true } - This ensures proper timezone handling for PostgreSQL databases - Update test snapshots to reflect the new timestamp format References: Preview Pr's https://github.com/better-auth/better-auth/pull/4440 https://github.com/better-auth/better-auth/pull/3477 Open issues: https://github.com/better-auth/better-auth/issues/3461 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Make PostgreSQL timestamps timezone-aware in the Drizzle schema generator by using timestamp(name, { withTimezone: true }). This fixes incorrect time handling and updates generated snapshots for all timestamp fields. - **Migration** - Regenerate the schema and run a migration to convert affected PostgreSQL columns to timestamp with time zone. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:21:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5392