Support Automatic updatedAt
Timestamps in Astro DB
#1107
mauriciabad
started this conversation in
Proposal
Replies: 1 comment
-
I think it's a reasonable proposal and I don't think we need a full RFC. Feel free to send a PR :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Body
Summary
Add support for automatic
updatedAt
timestamp updates in Astro DB, similar to howcreatedAt
works withNOW
, to prevent developers from forgetting to update timestamps manually.Background & Motivation
Currently, Astro DB supports automatic
createdAt
timestamps usingdefault: NOW
, but there's no equivalent forupdatedAt
. This means developers need to manually update the timestamp in every update query, which is error-prone and can lead to inconsistent data.Users coming from other ORMs like Drizzle or Prisma expect this functionality out of the box, as it's a common pattern in modern databases. The lack of this feature might push developers to use alternative solutions or implement potentially inconsistent workarounds.
Goals
updatedAt
columns when records are modifiedExample
Current approach (requires manual updates):
Proposed solution:
This would align Astro DB more closely with other modern ORMs while maintaining its simplicity and developer-friendly approach.
Beta Was this translation helpful? Give feedback.
All reactions