Jigar Bhaliya
08/05/2022, 12:24 PMMichael Jay
08/05/2022, 12:49 PMprisma.widget.findMany({
where: { isDeleted: true }
});
for boolean
prisma.widget.findMany({
where: { deletedAt lte now }
});
for dates, and you'll have to dig a little bit for the exact syntaxMichael Jay
08/05/2022, 12:50 PMis not null
Jigar Bhaliya
08/05/2022, 12:55 PMMichael Jay
08/05/2022, 1:04 PMfalse
for active records, and `false`'s complement true
for soft-deleted records.
You can find* the active records with a where clause like: { deleted: false }
You can find* the soft-deleted records with a where clause like: { deleted: true }
Since the sets are disjoint (and complementary), it would suffice then to find all records where deleted is false OR where deleted is true. That would be all of them.
So then, if you want "all records including deleted records for one place" - with an id placeId, then your where clause could look like:
where: {
OR: [
{ placeId: placeId, deleted: false }, // get active records
{ placeId: placeId, deleted: true }, // get soft-deleted records
]
}
which is of course logically equivalent to:
where: { placeId: placeId }
Nurul
08/05/2022, 1:32 PMi want all records including deleted records for one place.This would be equivalent to a normal
findMany
call and deleted field won’t matter in this case.