Relational delete with returning

Is there a way to get deleted rows back but also selecting relations? Right now we have:
const results = await db.query.scheduledCalls.findMany({
limit,
offset,
where: eq(scheduledCalls.queueName, queueName),
with: {
lead: true,
},
});
const results = await db.query.scheduledCalls.findMany({
limit,
offset,
where: eq(scheduledCalls.queueName, queueName),
with: {
lead: true,
},
});
But we want to do with the delete() and returning()
1 Reply
Angelelz
Angelelz14mo ago
There is no way in SQL to delete rows from 2 different table in one query You'll have to do as many queries as table you need to delete from inside a transaction The relations API is only available for select
Want results from more Discord servers?
Add your server