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.

small script updates

Steven Tey68a5699650a4
diff --git a/apps/web/scripts/send-batch-emails.ts b/apps/web/scripts/send-batch-emails.ts
index bfb78163a1..fe14ef770d 100644
--- a/apps/web/scripts/send-batch-emails.ts
+++ b/apps/web/scripts/send-batch-emails.ts
@@ -22,6 +22,9 @@ async function main() {
},
},
},
+ email: {
+ not: null,
+ },
},
take: 10000,
});
diff --git a/apps/web/scripts/sent-mail-reset.ts b/apps/web/scripts/sent-mail-reset.ts
new file mode 100644
index 0000000000..2b2bc98f8d
--- /dev/null
+++ b/apps/web/scripts/sent-mail-reset.ts
@@ -0,0 +1,28 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+async function main() {
+ while (true) {
+ const users = await prisma.user.findMany({
+ where: {
+ sentMail: true,
+ },
+ take: 1000,
+ });
+ if (users.length === 0) {
+ console.log("No more users to update");
+ break;
+ }
+ await prisma.user.updateMany({
+ where: {
+ id: { in: users.map((user) => user.id) },
+ },
+ data: {
+ sentMail: false,
+ },
+ });
+ console.log(`Updated ${users.length} users to sentMail: false`);
+ }
+}
+
+main();