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.

add index on projectId+url

Steven Tey59893788865a
diff --git a/apps/web/app/api/links/upsert/route.ts b/apps/web/app/api/links/upsert/route.ts
index fdca254581..983727694c 100644
--- a/apps/web/app/api/links/upsert/route.ts
+++ b/apps/web/app/api/links/upsert/route.ts
@@ -22,14 +22,6 @@ export const PUT = withWorkspace(
const bodyRaw = await parseRequestBody(req);
const body = createLinkBodySchema.parse(bodyRaw);
- if (workspace.totalLinks > 100000) {
- throw new DubApiError({
- code: "forbidden",
- message:
- "Link upserts are not recommended for workspaces with more than 100,000 links. Try doing GET `/links/info` + POST `/links` instead.",
- });
- }
-
const link = await prisma.link.findFirst({
where: {
projectId: workspace.id,
diff --git a/packages/prisma/schema/link.prisma b/packages/prisma/schema/link.prisma
index bd1452748e..93a9c174e0 100644
--- a/packages/prisma/schema/link.prisma
+++ b/packages/prisma/schema/link.prisma
@@ -84,6 +84,7 @@ model Link {
commissions Commission[]
@@unique([domain, key])
+ @@index([projectId, url(length: 500)])
@@index([projectId, folderId, archived, createdAt(sort: Desc)])
@@unique([projectId, externalId])
@@index([programId, partnerId])