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.

Create backfill-default-program-ids.ts

Steven Teyb0b5a49db7fe
diff --git a/apps/web/scripts/backfill-default-program-ids.ts b/apps/web/scripts/backfill-default-program-ids.ts
new file mode 100644
index 0000000000..d79e79627a
--- /dev/null
+++ b/apps/web/scripts/backfill-default-program-ids.ts
@@ -0,0 +1,17 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+async function main() {
+ const programs = await prisma.program.findMany();
+
+ await Promise.all(
+ programs.map(async (program) => {
+ await prisma.project.update({
+ where: { id: program.workspaceId },
+ data: { defaultProgramId: program.id },
+ });
+ }),
+ );
+}
+
+main();