Open scottsymm opened 9 months ago
Heya,
Thanks for raising this! That pattern currently does not work unfortunately. This is because the extension adds the configured field deletedAt
if it is not found at the top level of the where object, so the query is modified to this:
.findUnique({ where: { id: row.id, NOT: { deletedAt: null }, deletedAt: null } });
I'm planning on modifying the way I handle logical operations (NOT, AND, OR) in where objects, when I do that I will make sure this case also works.
In the meantime you can use an alternate query that has the deletedAt
field at the top level:
.findUnique({ where: { id: row.id, deletedAt: { not: null } });
I hope that helps! I'm going to keep this issue open until I've fixed your original query as that should work as expected 👍
@olivierwilkinson Any suggestions on doing something like this for include
queries?
I'm trying to select all related models (including soft deleted ones).
await prisma.appointment.findUnique({
where: {
id: params.id,
},
include: {
services: {
where: {
NOT: { deletedAt: null },
},
},
},
});
@dmaksimov did you ever figure out a good solution for this?
should i be able to include soft deleted rows when using deletedAt ?
generates