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 database schema

Kiran Kb03c720a5dad
diff --git a/apps/web/prisma/schema/link.prisma b/apps/web/prisma/schema/link.prisma
index 4340411f43..bcb7d0446e 100644
--- a/apps/web/prisma/schema/link.prisma
+++ b/apps/web/prisma/schema/link.prisma
@@ -56,7 +56,8 @@ model Link {
tags LinkTag[]
// Comments on the particular shortlink
- comments String? @db.LongText
+ comments String? @db.LongText
+ webhooks Webhook[]
@@unique([domain, key])
@@unique([projectId, externalId])
diff --git a/apps/web/prisma/schema/webhook.prisma b/apps/web/prisma/schema/webhook.prisma
new file mode 100644
index 0000000000..15295cfdd5
--- /dev/null
+++ b/apps/web/prisma/schema/webhook.prisma
@@ -0,0 +1,30 @@
+enum WebhookSource {
+ zapier
+ make
+ user
+}
+
+enum WebhookEventTrigger {
+ LINK_CLICKED
+ LINK_CREATED
+}
+
+model Webhook {
+ id String @id @default(cuid())
+ projectId String
+ linkId String?
+ name String
+ url String
+ secret String?
+ active Boolean @default(true)
+ source WebhookSource
+ eventTriggers Json
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ Project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ Link Link? @relation(fields: [linkId], references: [id], onDelete: Cascade)
+
+ @@index([projectId])
+ @@index([linkId])
+}
diff --git a/apps/web/prisma/schema/workspace.prisma b/apps/web/prisma/schema/workspace.prisma
index d77edca92b..d98cd7659e 100644
--- a/apps/web/prisma/schema/workspace.prisma
+++ b/apps/web/prisma/schema/workspace.prisma
@@ -36,6 +36,7 @@ model Project {
oAuthCodes OAuthCode[]
oAuthApps OAuthApp[] // OAuth apps workspace published
oAuthAuthorizedApps OAuthAuthorizedApp[] // OAuth apps workspace authorized
+ webhooks Webhook[]
@@index(usageLastChecked(sort: Asc))
}