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.

script that we can use to delete existing link's caches

Kiran K27d76f06e2e0
diff --git a/apps/web/scripts/delete-link-cache.ts b/apps/web/scripts/delete-link-cache.ts
new file mode 100644
index 0000000000..c41a894869
--- /dev/null
+++ b/apps/web/scripts/delete-link-cache.ts
@@ -0,0 +1,28 @@
+import { redis } from "@/lib/upstash";
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+// This script delete the existing link's cache
+// Run this after https://github.com/dubinc/dub/pull/1335 is merged
+async function main() {
+ const domains = await prisma.domain.findMany({
+ take: 1,
+ skip: 0,
+ });
+
+ if (domains.length === 0) {
+ console.log("No domains found");
+ return;
+ }
+
+ const pipeline = redis.pipeline();
+
+ domains.map((domain) => pipeline.del(domain.slug.toLocaleLowerCase()));
+
+ const result = await pipeline.exec();
+
+ // 1 means success, 0 means failure
+ console.log("Result", result);
+}
+
+main();