Can i somehow combine a primary key and a boolean ...
# orm-help
h
Can i somehow combine a primary key and a boolean with findUnique() ? primary key should handle this but i get "is not assignable to TABLEWhereUniqueInput"
r
Creating a compound unique index is the only way you could do this.
Copy code
@@unique([uuid, boolean])
And then use it in
findUnique
.
h
Thx, i see really no problem doing that, the uuid is still unique by its own :-)
👍 1
hmm, problem is it is a relation
@Ryan Any way i can do something like this with prisma?
Copy code
SELECT
    m.*
FROM "Map" AS m
JOIN "MapData" AS d ON d."mapId" = m.id
WHERE d.id = $1 AND m.deleted = true
r
Yeah something like this:
Copy code
await prisma.map.findMany({
  where: { 
    AND: [
      { mapData: { some: { id: 'some-id' } } },
      { deleted: true },
    ]
  }
})
Change the fields as per your model.