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.

remove old tables/columns

Steven Teyd8816d720563
diff --git a/apps/web/scripts/migrate-commission-attributes.ts b/apps/web/scripts/migrate-commission-attributes.ts
index 59371020e4..cdf5c30466 100644
--- a/apps/web/scripts/migrate-commission-attributes.ts
+++ b/apps/web/scripts/migrate-commission-attributes.ts
@@ -30,17 +30,6 @@ async function main() {
},
});
- if (!program.defaultRewardId) {
- await prisma.program.update({
- where: {
- id: program.id,
- },
- data: {
- defaultRewardId: reward.id,
- },
- });
- }
-
console.log(`Migrated commission attributes for program ${program.id}`);
}
}
diff --git a/apps/web/scripts/migrate-rewards.ts b/apps/web/scripts/migrate-rewards.ts
index ceb9d7a27f..f87c84f14a 100644
--- a/apps/web/scripts/migrate-rewards.ts
+++ b/apps/web/scripts/migrate-rewards.ts
@@ -1,3 +1,6 @@
+// @ts-nocheck – this is a one-time migration script for
+// when we migrate the rewards table to the new schema
+
import { REWARD_EVENT_COLUMN_MAPPING } from "@/lib/zod/schemas/rewards";
import { prisma } from "@dub/prisma";
import "dotenv-flow/config";
diff --git a/apps/web/scripts/partners/delete-program.ts b/apps/web/scripts/partners/delete-program.ts
index b74b1514ff..da691d8c71 100644
--- a/apps/web/scripts/partners/delete-program.ts
+++ b/apps/web/scripts/partners/delete-program.ts
@@ -4,13 +4,10 @@ import "dotenv-flow/config";
import { storage } from "../../lib/storage";
async function main() {
- const program = await prisma.program.update({
+ const program = await prisma.program.findUniqueOrThrow({
where: {
id: "prog_1JWPV1GFN7K4XEYZHZ3DS5VTG",
},
- data: {
- defaultRewardId: null,
- },
});
if (program.defaultFolderId) {
diff --git a/packages/prisma/schema/program.prisma b/packages/prisma/schema/program.prisma
index 1fe48cde9f..62df792ddb 100644
--- a/packages/prisma/schema/program.prisma
+++ b/packages/prisma/schema/program.prisma
@@ -37,7 +37,6 @@ model Program {
cookieLength Int @default(90)
holdingPeriodDays Int @default(0) // number of days to wait before earnings are added to a payout
minPayoutAmount Int @default(10000) // Default minimum payout amount of $100
- defaultRewardId String? @unique // TODO: Remove this after https://github.com/dubinc/dub/pull/2504 merges
defaultDiscountId String? @unique // default discount for the program
embedData Json? @db.Json
landerData Json? @db.Json
diff --git a/packages/prisma/schema/reward.prisma b/packages/prisma/schema/reward.prisma
index ae5120b560..055008240c 100644
--- a/packages/prisma/schema/reward.prisma
+++ b/packages/prisma/schema/reward.prisma
@@ -24,26 +24,10 @@ model Reward {
updatedAt DateTime @updatedAt
program Program @relation(fields: [programId], references: [id], onDelete: Cascade)
- partners PartnerReward[]
clickEnrollments ProgramEnrollment[] @relation("ClickRewardEnrollments")
leadEnrollments ProgramEnrollment[] @relation("LeadRewardEnrollments")
saleEnrollments ProgramEnrollment[] @relation("SaleRewardEnrollments")
@@index([programId, event])
@@index(event) // used in aggregate-clicks cron job
-}
-
-// TODO: Remove this table after https://github.com/dubinc/dub/pull/2504 merges
-model PartnerReward {
- id String @id @default(cuid())
- programEnrollmentId String
- rewardId String
-
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- reward Reward @relation(fields: [rewardId], references: [id], onDelete: Cascade)
-
- @@unique([programEnrollmentId, rewardId])
- @@index(rewardId)
-}
+}
\ No newline at end of file