[PR #4889] [MERGED] fix(cli): defaultNow is deprecated in schema for Drizzle with SQLite #13886

Closed
opened 2026-04-13 09:11:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4889
Author: @himself65
Created: 9/24/2025
Status: Merged
Merged: 9/25/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/09/24/default-now


📝 Commits (3)

  • 46760bc fix(cli): defaultNow is deprecated in schema for Drizzle with SQLite
  • 656c314 chore: lint fix
  • d149497 chore: update

📊 Changes

5 files changed (+65 additions, -37 deletions)

View changed files

📝 packages/cli/src/generators/drizzle.ts (+37 -13)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-number-id.txt (+7 -6)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-passkey-number-id.txt (+7 -6)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-passkey.txt (+7 -6)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite.txt (+7 -6)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/4796


Summary by cubic

Switch Drizzle SQLite timestamp defaults from defaultNow() to default(sql(current_timestamp)) to avoid the deprecated API and generate valid schemas. Other databases keep defaultNow().

  • Bug Fixes
    • For SQLite, use .default(sql(current_timestamp)) on date fields instead of .defaultNow().
    • Conditionally import sql from "drizzle-orm" only when SQLite timestamp defaults are present.
    • Simplified import generation to include only needed types; updated snapshots to match output.

🔄 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/4889 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/24/2025 **Status:** ✅ Merged **Merged:** 9/25/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/24/default-now` --- ### 📝 Commits (3) - [`46760bc`](https://github.com/better-auth/better-auth/commit/46760bc8733525a886f5e3f88249019fd1f340aa) fix(cli): defaultNow is deprecated in schema for Drizzle with SQLite - [`656c314`](https://github.com/better-auth/better-auth/commit/656c314e0a7759a4699c6ed8b91404e9d05db8dc) chore: lint fix - [`d149497`](https://github.com/better-auth/better-auth/commit/d14949776d6650fc78bbac5b9df18cefb740d464) chore: update ### 📊 Changes **5 files changed** (+65 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/generators/drizzle.ts` (+37 -13) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-number-id.txt` (+7 -6) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-passkey-number-id.txt` (+7 -6) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-passkey.txt` (+7 -6) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite.txt` (+7 -6) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/4796 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switch Drizzle SQLite timestamp defaults from defaultNow() to default(sql`(current_timestamp)`) to avoid the deprecated API and generate valid schemas. Other databases keep defaultNow(). - **Bug Fixes** - For SQLite, use .default(sql`(current_timestamp)`) on date fields instead of .defaultNow(). - Conditionally import sql from "drizzle-orm" only when SQLite timestamp defaults are present. - Simplified import generation to include only needed types; updated snapshots to match output. <!-- 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-04-13 09:11:47 -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#13886