```model ProjectCategories { project Proje...
# orm-help
h
Copy code
model ProjectCategories {
  project       Project  @relation(fields: [projectId], references: [id])
  projectId  String // relation scalar field (used in the `@relation` attribute above)
  category   Category @relation(fields: [categoryId], references: [id])
  categoryId String // relation scalar field (used in the `@relation` attribute above)


  @@id([projectId, categoryId])
}
r
It seems you’re using the incorrect type to reference the foreign key
Try adding
@db.Uuid
to the
projectId
here as well.
h
ah okie.
error disappeared. let me try to run n check if it works. can i rename this table as well to be postgres naming convention comptaible?
r
You can use @@map to achieve this.
h
thanks.
Copy code
const project = await prisma.project.findFirst({
                where: {
                    username: {
                        equals: slug,
                    },
                },
                include: {
                    categories: { include: { category: true } },
                },
            });
@Ryan is this the right way to get the thru table? will we need to do such a nested include to get the name?
isnt there just an easier way to solve to get the details
r
Currently if you’re using a separate model for the many-to-many relation then you would need to do a nested include.
h
ok
Thanks a lot @Ryan
🙌 1