allo - i have a question about self-joins (joining...
# orm-help
j
allo - i have a question about self-joins (joining a model to itself) i have a model
Workflow
that looks like this:
Copy code
model Workflow {
id: 
  id                String       @id @default(cuid())
  // ...
  previousReview    Workflow?    @relation("WorkflowToWorkflow", fields: [workflowId], references: [id])
  nextReview        Workflow[]   @relation("WorkflowToWorkflow")
  workflowId        String?
}
they can form links in a chain, each one pointing at the next one using the
workflowId
column. when i make a query like this:
Copy code
const workflow = await prisma.workflow.findUnique({
    where: {
        id
    },
    includes: {
        previousReview: true,
        nextReview: true,
    }
})
i can get the previous review fine, but the next review always seems to come out as null, even when it does exist what am i doing wrong?
r
@Jaye 👋 Can one workflow point to many workflows (as your schema suggests)?