Hi guys! I was using a loop but haven't find an an...
# orm-help
s
Hi guys! I was using a loop but haven't find an answer for my question. I am in the middle of migration to prisma from prisma1 and I am wondering if I can do it partly and for some time have prisma1 and prisma2 in my project. I am using GraphQL for queries. I am aware of that if I want to get nested fields with Graphql query I need to use custom resolver as the docs says. Is it possible to fetch nested data which is available only in prisma2, using prisma1 query? Is it possible to create resolver which will use prisma2 to fetch nested object while using prisma1 client? For example:
type User {
id: String
stats: Stats
}
type Stats {
id: String
}
I have User in prisma1 and prisma2. And I have stats in prisma2 only. When I am overriding whole user query to prisma2 it works good with custom resolver to receive stats:
Copy code
User {
 stats: (parent, args, context) => {
  return context.newPrisma.user.findUnique({
    where: { id: parent.id },
  }).stats();
 }
}
But when I won't override user query to new prisma and will use old prisma to fetch user, it won't use stats resolver 😞 Is it possible to somehow force graphql/prisma to use prisma2 resolver inside prisma1 query? This is only simple example, application is complex so I would like to somehow keep it consistent for now and migrate it part by part. Thanks in advance and have a great Monday!
n
Hey 👋 From the upgrade strategies docs here, you could do a Gradual upgrade side-by-side: Add Prisma version 2.x and later to the existing Prisma 1 project and gradually replace existing Prisma 1 features with the newer Prisma features while running them side-by-side. Also, I think #prisma1 would be an ideal channel for this query, we have team members who are. monitoring that channel and could help you in upgrading from prisma1.
✅ 1