Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update cleanup-fraud-events.ts

Kiran K743f6237e26c
diff --git a/apps/web/scripts/migrations/cleanup-fraud-events.ts b/apps/web/scripts/migrations/cleanup-fraud-events.ts
index fb6905a2ce..916421a4c2 100644
--- a/apps/web/scripts/migrations/cleanup-fraud-events.ts
+++ b/apps/web/scripts/migrations/cleanup-fraud-events.ts
@@ -28,23 +28,26 @@ async function cleanupSingleEventGroups() {
const groupIds = fraudGroups.map(({ id }) => id);
await prisma.$transaction(async (tx) => {
- // Delete the group
- await tx.fraudEventGroup.deleteMany({
+ // Delete the raw events
+ const deletedEvents = await tx.fraudEvent.deleteMany({
where: {
- id: {
+ fraudEventGroupId: {
in: groupIds,
},
},
});
- // Delete the raw events
- await tx.fraudEvent.deleteMany({
+ // Delete the group
+ const deletedGroups = await tx.fraudEventGroup.deleteMany({
where: {
- fraudEventGroupId: {
+ id: {
in: groupIds,
},
},
});
+
+ console.log(`Deleted ${deletedEvents.count} fraud events`);
+ console.log(`Deleted ${deletedGroups.count} fraud event groups`);
});
}