@map("updated_at") still shows updatedAt in prisma studio
Hey,
So I did
But when I go and do npx prisma studio, I still see it there as updatedAt, why?
2 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
The
@map
attribute in Prisma is used to map a field in your Prisma model to a differently named column in your database, not to change how the field appears in Prisma Studio.
When you use @map("updated_at")
, you're telling Prisma that this field should be called updatedAt
in your Prisma model (and therefore in Prisma Studio and your Prisma Client API), but it corresponds to a column named updated_at
in your database.
Prisma Studio always displays the field names as they are defined in your Prisma model, not the database column names. This is by design, as Prisma Studio is meant to work with your Prisma models rather than directly with the database schema.
If you want to see the actual database column names, you would need to use a database management tool like pgAdmin, MySQL Workbench, or similar, depending on your database provider.
The @updatedAt
attribute, on the other hand, is a Prisma-level feature that automatically updates the timestamp when a record is modified, as mentioned in the Prisma Schema Reference.
I hope this clarifies why you're still seeing updatedAt
in Prisma Studio despite using the @map
attribute!
kapa.aiWas the bot answer helpful? Please let us know in case you still need any assistance.