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 the db schema

Kiran K33029277d2c5
diff --git a/apps/web/prisma/schema/folder.prisma b/apps/web/prisma/schema/folder.prisma
new file mode 100644
index 0000000000..a96d48e3fe
--- /dev/null
+++ b/apps/web/prisma/schema/folder.prisma
@@ -0,0 +1,26 @@
+model Folder {
+ id String @id @default(cuid())
+ name String
+ projectId String
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ links LinkFolder[]
+
+ @@unique([name, projectId])
+ @@index(projectId)
+}
+
+model LinkFolder {
+ id String @id @default(cuid())
+ folderId String
+ linkId String
+ createdAt DateTime @default(now())
+
+ link Link @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+ folder Folder @relation(fields: [folderId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+
+ @@unique(linkId)
+ @@index(folderId)
+}
diff --git a/apps/web/prisma/schema/link.prisma b/apps/web/prisma/schema/link.prisma
index fd921135f6..40e6b5d10f 100644
--- a/apps/web/prisma/schema/link.prisma
+++ b/apps/web/prisma/schema/link.prisma
@@ -56,6 +56,9 @@ model Link {
// Link tags
tags LinkTag[]
+ // Link folder
+ folder LinkFolder?
+
// Link webhooks
webhooks LinkWebhook[]
diff --git a/apps/web/prisma/schema/workspace.prisma b/apps/web/prisma/schema/workspace.prisma
index daf358f9bf..653adb4dab 100644
--- a/apps/web/prisma/schema/workspace.prisma
+++ b/apps/web/prisma/schema/workspace.prisma
@@ -47,6 +47,7 @@ model Project {
integrations Integration[] // Integrations workspace published
installedIntegrations InstalledIntegration[] // Integrations workspace installed
webhooks Webhook[]
+ folders Folder[]
@@index(usageLastChecked(sort: Asc))
}