Remove extra call to delete options (#299)

This commit is contained in:
Luke Vella 2022-08-22 10:10:30 +01:00 committed by GitHub
parent 9f86a7bdeb
commit 168f70aa2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,6 +96,7 @@ export default async function handler(
},
});
// Delete votes
await prisma.vote.deleteMany({
where: {
pollId: {
@ -122,10 +123,6 @@ export default async function handler(
},
});
await prisma.$executeRaw`DELETE FROM options WHERE poll_id IN (${Prisma.join(
pollIdsToDelete,
)})`;
// Delete polls
// Using execute raw to bypass soft delete middelware
await prisma.$executeRaw`DELETE FROM polls WHERE id IN (${Prisma.join(