studio
studio copied to clipboard
@updatedAt not behaving correctly on Prisma Studio
-
Prisma version (
prisma -vornpx prisma -v): 3.7.0 -
Logs from Developer Tools Console or Command line, if any:
❯ yarn prisma studio
Prisma schema loaded from prisma/schema.prisma
Prisma Studio is up on http://localhost:5555
warn(prisma-client) There are already 10 instances of Prisma Client actively running.
-
Does the issue persist even after updating to the latest
prismaCLI dev version? (npm i -D prisma@dev)?: Yes -
Prisma schema (if relevant):
model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
username String @unique
password String
}
Scenario
When you click "Add Record", the updatedAt column is prepopulated by the time when you clicked that button.

What happens
As you edit the row and eventually save it, the row gets persisted in the DB but then the createdAt column (which is determined by the DB on write) will be later than the updatedAt.

What I expected to happen
When a row is created, updatedAt should be initially set to createdAt.
Other relevant details
I'm using Postgres 13.4.