maxpowernz
TTCTheo's Typesafe Cult
•Created by maxpowernz on 2/5/2024 in #questions
alias prisma id field
Hi There,
It doesn't look likes its possible to alias the primary key of a Prisma table on select with the ORM unless using RAW SQL.
What I want to do is have all the tables PK, i.e. table1Id, table2Id, table3Id aliased to the name key.
I have a generic table which will display arbitrary data and key is in the base type and I extend from there.
I know I can map it back out with the PK mapped to key, but is there another way? It seems like a lacking feature of the ORM.
Other option is to use generics of course
Just interested to know how you guys do it.
Cheers.
1 replies