Hi all, is it possible to have a relation against ...
# orm-help
j
Hi all, is it possible to have a relation against a string column that looks like this:
1,2,3
?
r
@James 👋 So basically would that string column store multiple comma separated id’s? if so, that’s not possible with Prisma.
j
Yes that's correct, and ok I guess the solution is I'll write a custom resolver for this one
👍 1
hrm, my first attempt is
Copy code
t.field('Forms', {
  type: nonNull(list('Form')),
  resolve: async function (parent: any, args, ctx: Context) {
    return await ctx.prisma.forms.findMany({
      where: {
        related_id: {
          contains: parent.related_id.toString(),
        },
      },
    })
  },
})
but that looks insecure to me, so i think i need to use MySQL FIND_IN_SET() Function. Should I use prisma.$rawQuery() for this?
r
I think raw query would be the way to go.