DEV Community

Ahmed Nawaz Khan
Ahmed Nawaz Khan

Posted on

Prisma generated types can hinder changing the database layer later on?

I recently heard about prisma and wanted to try it. I really liked the simple interface it provides and the level of type saftey. however, I have one question. when we use prisma to query an entity, the response we get has a type that comes from @prisma/client ( prisma generated ). Though it has some advantages but this is where I think that a violation of open closed principle can occur. In the future if I want to change the database layer or the orm to typeorm then all the return types of my service methods have to be changed to reflect my entities (rather than previously prisma generated types). Think of it in context of nestjs where we have entities that are our common return types. Is there a way we can solve this problem with prisma? Or it is not a problem at all?

Top comments (0)