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 backfill-partner-groups.ts

Steven Tey3ef647bc1625
diff --git a/apps/web/scripts/migrations/backfill-partner-groups.ts b/apps/web/scripts/migrations/backfill-partner-groups.ts
index 5676234429..d7d29ef6a2 100644
--- a/apps/web/scripts/migrations/backfill-partner-groups.ts
+++ b/apps/web/scripts/migrations/backfill-partner-groups.ts
@@ -3,7 +3,7 @@ import { DEFAULT_PARTNER_GROUP } from "@/lib/zod/schemas/groups";
import { RESOURCE_COLORS } from "@/ui/colors";
import { prisma } from "@dub/prisma";
import { Prisma } from "@dub/prisma/client";
-import { ACME_PROGRAM_ID, randomValue } from "@dub/utils";
+import { randomValue } from "@dub/utils";
import "dotenv-flow/config";
// one time script for migrating to partner groups
@@ -17,8 +17,10 @@ async function main() {
"discountId",
],
where: {
- programId: ACME_PROGRAM_ID,
- status: "approved",
+ groupId: null,
+ status: {
+ notIn: ["pending", "rejected", "banned"],
+ },
},
_count: {
_all: true,
@@ -31,6 +33,7 @@ async function main() {
});
console.log(`Found total of ${groups.length} groups`);
+ console.table(groups);
const rewards = await prisma.reward.findMany({
where: {
@@ -182,7 +185,7 @@ async function main() {
});
if (isDefaultGroup) {
- const programRes = await prisma.program.update({
+ await prisma.program.update({
where: { id: group.programId },
data: { defaultGroupId: finalGroupId },
});