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.

Move all program links into a folder

Kiran Kad41654520b9
diff --git a/apps/web/scripts/move-links-to-folder.ts b/apps/web/scripts/move-links-to-folder.ts
new file mode 100644
index 0000000000..426005ac3c
--- /dev/null
+++ b/apps/web/scripts/move-links-to-folder.ts
@@ -0,0 +1,35 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+// Move the program links to a folder.
+async function main() {
+ const workspaceId = "";
+ const folderId = "";
+
+ const links = await prisma.link.findMany({
+ where: {
+ projectId: workspaceId,
+ programId: {
+ not: null,
+ },
+ },
+ });
+
+ if (links.length === 0) {
+ console.log("No links found.");
+ return;
+ }
+
+ await prisma.link.updateMany({
+ where: {
+ id: {
+ in: links.map((link) => link.id),
+ },
+ },
+ data: {
+ folderId,
+ },
+ });
+}
+
+main();