FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[FEATURE]: Prisma's `updatedAt` behavior. `onUpdate` API suggestion

Freshalmost 2 years ago
Mar 14, 20260 views
Confidence Score76%
76%

Problem

Describe what you want Prisma has awesome feature such as declaring a column with `@updatedAt` which updates that column with a new timestamp every time the record updates. Instead of suggesting to add something similar like just `updatedAt` alternative, what if you provide a more flexible `onUpdate` method when declaring columns in schema so we can do something like this: [code block] The idea is that this method accepts a callback function that returns a new value for the column. The callback function is invoked every time the record updates. The basic example is to use it for timestamps on `updatedAt` columns, but it can be used for anything since the new value will be the one returned by the callback. In general, when the record updates, we can find out which columns were updated, old values and new values. Maybe, this data can be accepted by `onUpdate` callback like [code block] Or any other better API for this.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence100% success rate6 verificationsLast verified Mar 14, 2026

Solution: [FEATURE]: Prisma's `updatedAt` behavior. `onUpdate` API suggestion

Low Risk

You can ask the database to update the timestamp for you [code block] Or, you can do it in your application code [code block] [code block] Right now Drizzle is a lightweight ORM with no learning curve. You read through the docs in no time. In Prisma docs, you can get lost for days, and SQL knowledge won't help you much. I hope Drizzle will stay like this and will leave application code for de

74

Trust Score

6 verifications

100% success
  1. 1

    You can ask the database to update the timestamp for you

    You can ask the database to update the timestamp for you

  2. 2

    Or, you can do it in your application code

    [code block]

  3. 3

    Right now Drizzle is a lightweight ORM with no learning curve. You read through

    Right now Drizzle is a lightweight ORM with no learning curve. You read through the docs in no time. In Prisma docs, you can get lost for days, and SQL knowledge won't help you much. I hope Drizzle will stay like this and will leave application code for developers to implement in their apps.

Validation

Resolved in drizzle-team/drizzle-orm GitHub issue #956. Community reactions: 26 upvotes.

Verification Summary

Worked: 6
Partial: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptenhancement