studio icon indicating copy to clipboard operation
studio copied to clipboard

@updatedAt not behaving correctly on Prisma Studio

Open dashmug opened this issue 4 years ago • 0 comments

  1. Prisma version (prisma -v or npx prisma -v): 3.7.0

  2. 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.
  1. Does the issue persist even after updating to the latest prisma CLI dev version? (npm i -D prisma@dev)?: Yes

  2. 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.

Screen Shot 2022-01-05 at 10 18 13 pm

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.

Screen Shot 2022-01-05 at 10 18 47 pm

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.

dashmug avatar Jan 05 '22 11:01 dashmug