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-program-application-status.ts

Kiran Kc1f11d402d27
diff --git a/apps/web/scripts/migrations/backfill-program-application-status.ts b/apps/web/scripts/migrations/backfill-program-application-status.ts
index 6ca8ecaac8..e8fd723bd8 100644
--- a/apps/web/scripts/migrations/backfill-program-application-status.ts
+++ b/apps/web/scripts/migrations/backfill-program-application-status.ts
@@ -222,6 +222,11 @@ async function backfillRejectedFromRejectionFields() {
while (true) {
const applications = await prisma.programApplication.findMany({
where: {
+ ...(cursor && {
+ id: {
+ gt: cursor,
+ },
+ }),
enrollment: null,
status: ProgramApplicationStatus.pending,
OR: [
@@ -247,12 +252,6 @@ async function backfillRejectedFromRejectionFields() {
id: "asc",
},
take: BATCH_SIZE,
- ...(cursor && {
- skip: 1,
- cursor: {
- id: cursor,
- },
- }),
});
if (applications.length === 0) {
@@ -340,6 +339,11 @@ async function backfillPartnerIdsByEmail() {
while (true) {
const applications = await prisma.programApplication.findMany({
where: {
+ ...(cursor && {
+ id: {
+ gt: cursor,
+ },
+ }),
enrollment: null,
partnerId: null,
},
@@ -351,12 +355,6 @@ async function backfillPartnerIdsByEmail() {
id: "asc",
},
take: BATCH_SIZE,
- ...(cursor && {
- skip: 1,
- cursor: {
- id: cursor,
- },
- }),
});
if (applications.length === 0) {
@@ -424,6 +422,11 @@ async function backfillFromActivityLogs() {
while (true) {
const applications = await prisma.programApplication.findMany({
where: {
+ ...(cursor && {
+ id: {
+ gt: cursor,
+ },
+ }),
enrollment: null,
status: ProgramApplicationStatus.pending,
reviewedAt: {
@@ -441,12 +444,6 @@ async function backfillFromActivityLogs() {
id: "asc",
},
take: BATCH_SIZE,
- ...(cursor && {
- skip: 1,
- cursor: {
- id: cursor,
- },
- }),
});
if (applications.length === 0) {
@@ -602,6 +599,11 @@ async function backfillFromAuditLogs() {
while (true) {
const applications = await prisma.programApplication.findMany({
where: {
+ ...(cursor && {
+ id: {
+ gt: cursor,
+ },
+ }),
enrollment: null,
status: ProgramApplicationStatus.pending,
reviewedAt: {
@@ -620,12 +622,6 @@ async function backfillFromAuditLogs() {
id: "asc",
},
take: BATCH_SIZE,
- ...(cursor && {
- skip: 1,
- cursor: {
- id: cursor,
- },
- }),
});
if (applications.length === 0) {