PocketColin
PPrisma
•Created by PocketColin on 1/23/2025 in #help-and-questions
Custom/composite IDs as relation references
I am exploring Prisma as an alternative to our current ORM/backend, Parse, due to it not being very well maintained. Overall, the migration is looking pretty clean, but I'm running into an issue around translating the way Parse did relations and the way Prisma does them (this is for a Mongo database). Parse does it by having a relation field (or "pointer") with a composite key string value of
ClassName$RecordID
(i.e., Author$a43fE3f3
) instead of the way Prisma does it where you define the class as a separate relation type field not stored in the DB. So my question is: is it possible to do this sort of custom relation reference value and, if so, how? The only other way I can imagine getting around this issue is to backfill a new ID fields onto every record with a relation in my database which just isn't feasible.3 replies