Remove createdAt/updatedAt from database schema #1421

Closed
opened 2026-03-13 08:39:19 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @rebasecase on GitHub (Jun 26, 2025).

The automatic inclusion of createdAt and updatedAt fields in every database table is often treated as an assumed (and somewhat naïve) best practice. In reality, these fields offer minimal practical value in most applications and tend to be included more to satisfy generic audit conventions (what-if-ness) than to address any meaningful or concrete problem.

A more flexible and intentional approach would be to move this logic into application-level hooks, such as onCreate and onUpdate, where timestamps can be set, omitted, or customized based on real use cases. For applications that truly need auditability, a dedicated audit log or auditing table would be far more effective, capturing meaningful changes with better granularity and offering a much cleaner separation of concerns.

Given this framework already includes a broad range of built-in features, it seems reasonable to extend it further by either:

  • Providing an opt-in/opt-out configuration for timestamp fields like createdAt and updatedAt
  • Or supporting a more robust and flexible audit trail mechanism as a first-class feature

This would offer developers more control, reduce schema clutter, and encourage better practices around data change tracking.

Originally created by @rebasecase on GitHub (Jun 26, 2025). The automatic inclusion of `createdAt` and `updatedAt` fields in every database table is often treated as an assumed (and somewhat naïve) best practice. In reality, these fields offer minimal practical value in most applications and tend to be included more to satisfy generic audit conventions (what-if-ness) than to address any meaningful or concrete problem. A more flexible and intentional approach would be to move this logic into application-level hooks, such as `onCreate` and `onUpdate`, where timestamps can be set, omitted, or customized based on real use cases. For applications that truly need auditability, a dedicated audit log or auditing table would be far more effective, capturing meaningful changes with better granularity and offering a much cleaner separation of concerns. Given this framework already includes a broad range of built-in features, it seems reasonable to extend it further by either: - Providing an opt-in/opt-out configuration for timestamp fields like `createdAt` and `updatedAt` - Or supporting a more robust and flexible audit trail mechanism as a first-class feature This would offer developers more control, reduce schema clutter, and encourage better practices around data change tracking.
Author
Owner

@Kamleshpaul commented on GitHub (Jul 17, 2025):

Yeah, I also need a way to disable BetterAuth’s autogenerated createdAt/updatedAt.

@Kamleshpaul commented on GitHub (Jul 17, 2025): Yeah, I also need a way to disable BetterAuth’s autogenerated createdAt/updatedAt.
Author
Owner

@frectonz commented on GitHub (Aug 11, 2025):

The design of better auth relies on those columns, those columns are necessary for better auth to function properly.

@frectonz commented on GitHub (Aug 11, 2025): The design of better auth relies on those columns, those columns are necessary for better auth to function properly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1421