[PR #6696] feat: remove timestamp assignments un internalAdapter #6831

Open
opened 2026-03-13 13:13:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6696
Author: @Ridhim-RR
Created: 12/11/2025
Status: 🔄 Open

Base: canaryHead: chore/remove-manual-timestamp-assignments


📝 Commits (10+)

  • a336224 chore:remove-manual-timestamp-assignments
  • e5d2b7c Merge branch 'canary' into chore/remove-manual-timestamp-assignments
  • 43c6c3e fix(updatedAt): Assign default value to updatedAt at time of create
  • f003b2f Merge branch 'chore/remove-manual-timestamp-assignments' of https://github.com/Ridhim-RR/better-auth into chore/remove-manual-timestamp-assignments
  • 7dd6748 Merge branch 'canary' of https://github.com/Ridhim-RR/better-auth into chore/remove-manual-timestamp-assignments
  • 2e2e2cc fix(type and lint) type and linting resolved
  • 3729b10 fix(updatedAt): remove the chnages in the utils and factory.ts and directly add defaultValue in the session and account table in updatedAt
  • e9f29a0 chore(lint): linting issue resolved
  • 7101a50 chore(snapshots): snapshots updated
  • 88dac73 chore(snapshots) snapshots error resolved

📊 Changes

23 files changed (+46 additions, -22 deletions)

View changed files

📝 packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap (+2 -0)
📝 packages/better-auth/src/db/internal-adapter.ts (+2 -22)
📝 packages/cli/test/__snapshots__/auth-schema-drizzle-use-plural.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-duplicate-relations.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-multi-relation.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-mysql-enum.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-mysql-number-id.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-mysql-passkey-number-id.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-mysql-passkey.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-mysql-uuid.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-mysql.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-number-id.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-pg-enum.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-pg-passkey.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-pg-uuid.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-enum.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-number-id.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-passkey-number-id.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-passkey.txt (+2 -0)
📝 packages/cli/test/__snapshots__/auth-schema-sqlite-uuid.txt (+2 -0)

...and 3 more files

📄 Description

Removes manual createdAt/updatedAt assignments

🎯 Description

Removes redundant manual timestamp assignments from internal-adapter.ts as per the TODO comment:

// todo: we should remove auto setting createdAt and updatedAt in the next major release, since the db generators already handle that


Summary by cubic

Removed manual createdAt/updatedAt assignments in internal-adapter and set updatedAt on create via table defaults for session and account. This centralizes timestamp logic and prevents mismatches.

  • Refactors
    • Dropped timestamp fields from createWithHooks (user, account, session, verification).
    • Added defaultValue for updatedAt in getAuthTables (session, account); onUpdate continues to handle updates.

Written for commit ac443998bf. Summary will update automatically on new commits.


🔄 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/6696 **Author:** [@Ridhim-RR](https://github.com/Ridhim-RR) **Created:** 12/11/2025 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `chore/remove-manual-timestamp-assignments` --- ### 📝 Commits (10+) - [`a336224`](https://github.com/better-auth/better-auth/commit/a3362247116557dde7e5ef03572e48f1081b78bb) chore:remove-manual-timestamp-assignments - [`e5d2b7c`](https://github.com/better-auth/better-auth/commit/e5d2b7c356162a4e061c6f30ff7a8381a670266f) Merge branch 'canary' into chore/remove-manual-timestamp-assignments - [`43c6c3e`](https://github.com/better-auth/better-auth/commit/43c6c3ec8241f2a00010b020b48daaff816b31cc) fix(updatedAt): Assign default value to updatedAt at time of create - [`f003b2f`](https://github.com/better-auth/better-auth/commit/f003b2fea3e407940cb81d7413e8173bcab9e216) Merge branch 'chore/remove-manual-timestamp-assignments' of https://github.com/Ridhim-RR/better-auth into chore/remove-manual-timestamp-assignments - [`7dd6748`](https://github.com/better-auth/better-auth/commit/7dd6748d068b27b17beb7985110daec18c3a8492) Merge branch 'canary' of https://github.com/Ridhim-RR/better-auth into chore/remove-manual-timestamp-assignments - [`2e2e2cc`](https://github.com/better-auth/better-auth/commit/2e2e2cc29e83f2313b441150fe58974331e25555) fix(type and lint) type and linting resolved - [`3729b10`](https://github.com/better-auth/better-auth/commit/3729b10a604e7436f95f3c2efdf0c03cad4ea90b) fix(updatedAt): remove the chnages in the utils and factory.ts and directly add defaultValue in the session and account table in updatedAt - [`e9f29a0`](https://github.com/better-auth/better-auth/commit/e9f29a0f56a3867d5fd03deff3afdb4771f5608f) chore(lint): linting issue resolved - [`7101a50`](https://github.com/better-auth/better-auth/commit/7101a508bcc10ec3de957631231f1a76b1e7ebfe) chore(snapshots): snapshots updated - [`88dac73`](https://github.com/better-auth/better-auth/commit/88dac7316f13543f5f2874f824ece43ca9fee9a5) chore(snapshots) snapshots error resolved ### 📊 Changes **23 files changed** (+46 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap` (+2 -0) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+2 -22) 📝 `packages/cli/test/__snapshots__/auth-schema-drizzle-use-plural.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-duplicate-relations.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-multi-relation.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql-enum.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql-number-id.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql-passkey-number-id.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql-passkey.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql-uuid.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-mysql.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-number-id.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-pg-enum.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-pg-passkey.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-pg-uuid.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-enum.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-number-id.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-passkey-number-id.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-passkey.txt` (+2 -0) 📝 `packages/cli/test/__snapshots__/auth-schema-sqlite-uuid.txt` (+2 -0) _...and 3 more files_ </details> ### 📄 Description ## Removes manual `createdAt`/`updatedAt` assignments ✅ ### 🎯 **Description** Removes redundant manual timestamp assignments from `internal-adapter.ts` as per the TODO comment: > `// todo: we should remove auto setting createdAt and updatedAt in the next major release, since the db generators already handle that` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Removed manual createdAt/updatedAt assignments in internal-adapter and set updatedAt on create via table defaults for session and account. This centralizes timestamp logic and prevents mismatches. - **Refactors** - Dropped timestamp fields from createWithHooks (user, account, session, verification). - Added defaultValue for updatedAt in getAuthTables (session, account); onUpdate continues to handle updates. <sup>Written for commit ac443998bf0f60aa5cf30a249d35673f1b91f734. Summary will update automatically on new commits.</sup> <!-- 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 13:13:11 -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#6831