I've been using Prisma on my latest projectKaraoke Tools and as crazy as it may seem, I did not find any easy way (like a plugin) to handle soft delete behaviour.
So I had to tweak it myself manually and ending up in a case where
deletedAt
can be nulldeletedAt
can NOT exist
This is because I'm using mongo and no default value fordeletedAt
.
This filtering in Prisma is not handled by default (likedeletedAt: null
so I had to do it with anOR
request.
constitems=awaitprisma.event.findMany({...where:filters:{OR:[{deletedAt:{isSet:false}},{deletedAt:null}],...});
As it took me almost an hour to find this (chatGPT not being helpful), I wrote this article.
Cheers
Top comments(6)

- LocationNew York City
- WorkCo-founder & CTO at Cause of a Kind
- Joined
I just lost a few hours to this myself I wish I found this sooner, much appreciated!

I need help convert command sql to prisma:
SELECT acctuniqueid,
username,
callingstationid,
framedipaddress
FROM tiger.RadiusAcct
WHERE username = ${element.login}
AND acctstoptime IS NULL
AND NOT EXISTS (
SELECT 1
FROM tiger.RadiusAcct subquery
WHERE subquery.username = ${element.login}
AND subquery.acctstoptime IS NOT NULL
AND subquery.radacctid > tiger.RadiusAcct.radacctid
)
ORDER BY radacctid DESC
LIMIT 1;
For further actions, you may consider blocking this person and/orreporting abuse