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.

Split Prisma Schema into own files

Steven Teyd2284af7f5ca
diff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prisma
deleted file mode 100644
index 9ec5729e48..0000000000
--- a/apps/web/prisma/schema.prisma
+++ /dev/null
@@ -1,377 +0,0 @@
-// This is your Prisma schema file,
-// learn more about it in the docs: https://pris.ly/d/prisma-schema
-
-datasource db {
- provider = "mysql"
- url = env("DATABASE_URL")
- relationMode = "prisma"
-}
-
-generator client {
- provider = "prisma-client-js"
- previewFeatures = ["fullTextSearch", "fullTextIndex", "driverAdapters"]
-}
-
-model User {
- id String @id @default(cuid())
- name String?
- email String? @unique
- emailVerified DateTime?
- image String?
- isMachine Boolean @default(false)
-
- accounts Account[]
- sessions Session[]
- projects ProjectUsers[]
- links Link[]
- tokens Token[]
- restrictedTokens RestrictedToken[]
- createdAt DateTime @default(now())
- subscribed Boolean @default(true)
- source String?
- defaultWorkspace String?
-
- @@index(source)
- @@index(defaultWorkspace)
-}
-
-model Account {
- id String @id @default(cuid())
- userId String
- type String
- provider String
- providerAccountId String
- refresh_token String? @db.Text
- refresh_token_expires_in Int?
- access_token String? @db.Text
- expires_at Int?
- token_type String?
- scope String?
- id_token String? @db.Text
- session_state String?
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-
- @@unique([provider, providerAccountId])
- @@index([userId])
-}
-
-model Session {
- id String @id @default(cuid())
- sessionToken String @unique
- userId String
- expires DateTime
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-
- @@index([userId])
-}
-
-model VerificationToken {
- identifier String
- token String @unique
- expires DateTime
-
- @@unique([identifier, token])
-}
-
-model Token {
- id String @id @default(cuid())
- name String
- hashedKey String @unique
- partialKey String
- expires DateTime?
- lastUsed DateTime?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- userId String
-
- @@index([userId])
-}
-
-model RestrictedToken {
- id String @id @default(cuid())
- name String
- hashedKey String @unique
- partialKey String
- scopes String? // space separated (Eg: "links:write", "domains:read")
- expires DateTime?
- lastUsed DateTime?
- rateLimit Int @default(600) // rate limit per minute
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- userId String
- projectId String
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
-
- @@index([userId])
- @@index([projectId])
-}
-
-model Project {
- id String @id @default(cuid())
- name String
- slug String @unique
- logo String?
-
- plan String @default("free")
- stripeId String? @unique // Stripe subscription ID
- billingCycleStart Int // day of the month when the billing cycle starts
- stripeConnectId String? @unique // for Stripe Connect
- inviteCode String? @unique
-
- usage Int @default(0)
- usageLimit Int @default(1000)
- aiUsage Int @default(0)
- aiLimit Int @default(10)
- linksUsage Int @default(0)
- linksLimit Int @default(25)
- domainsLimit Int @default(3)
- tagsLimit Int @default(5)
- usersLimit Int @default(1)
-
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- usageLastChecked DateTime @default(now())
-
- users ProjectUsers[]
- invites ProjectInvite[]
- sentEmails SentEmail[]
- links Link[]
- domains Domain[]
- tags Tag[]
- customers Customer[]
- defaultDomains DefaultDomains[]
- restrictedTokens RestrictedToken[]
-
- @@index(usageLastChecked(sort: Asc))
-}
-
-model ProjectInvite {
- email String
- expires DateTime
- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
- projectId String
- createdAt DateTime @default(now())
-
- @@unique([email, projectId])
- @@index([projectId])
-}
-
-model DefaultDomains {
- id String @id @default(cuid())
- dublink Boolean @default(false)
- dubsh Boolean @default(true)
- chatgpt Boolean @default(true)
- sptifi Boolean @default(true)
- gitnew Boolean @default(true)
- amznid Boolean @default(true)
- ggllink Boolean @default(true)
- figpage Boolean @default(true)
- loooooooong Boolean @default(false)
- projectId String @unique
- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
-}
-
-enum Role {
- owner
- member
-}
-
-model ProjectUsers {
- id String @id @default(cuid())
- role Role @default(member)
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- userId String
- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
- projectId String
-
- @@unique([userId, projectId])
- @@index([projectId])
-}
-
-model SentEmail {
- id String @id @default(cuid())
- type String
- createdAt DateTime @default(now())
- project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
- projectId String?
-
- @@index([projectId])
-}
-
-model Domain {
- id String @id @default(cuid())
- slug String @unique
- verified Boolean @default(false)
- placeholder String @default("https://dub.co/help/article/what-is-dub")
- expiredUrl String? @db.LongText // URL to redirect to for expired links
- primary Boolean @default(false)
- archived Boolean @default(false)
- lastChecked DateTime @default(now())
- links Link[]
- project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
- projectId String?
-
- // these attributes will exist on both Link and Domain models
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- @@index(projectId)
- @@index(lastChecked(sort: Asc))
-}
-
-model Link {
- id String @id @default(cuid())
- domain String // domain of the link (e.g. dub.sh) – also stored on Redis
- key String // key of the link (e.g. /github) – also stored on Redis
- url String @db.LongText // target url (e.g. https://github.com/dubinc/dub) – also stored on Redis
- archived Boolean @default(false) // whether the link is archived or not
- expiresAt DateTime? // when the link expires – stored on Redis via ttl
- expiredUrl String? @db.LongText // URL to redirect the user to when the link is expired
- password String? // password to access the link
- externalId String?
-
- trackConversion Boolean @default(false) // whether to track conversions or not
-
- proxy Boolean @default(false) // Proxy to use custom OG tags (stored on redis) – if false, will use OG tags from target url
- title String? // OG title for the link (e.g. Dub.co - Open-Source Link Management Infrastructure)
- description String? @db.VarChar(280) // OG description for the link (e.g. An open-source link management tool for modern marketing teams to create, share, and track short links.)
- image String? @db.LongText // OG image for the link (e.g. https://d.to/og)
-
- // UTM parameters
- utm_source String? // UTM source for the link (e.g. youtube.com)
- utm_medium String? // UTM medium for the link (e.g. social)
- utm_campaign String? // UTM campaign for the link (e.g. summer-sale)
- utm_term String? // UTM term for the link (e.g. dub)
- utm_content String? // UTM content for the link (e.g. description)
-
- // Link cloaking/masking via rewrite
- rewrite Boolean @default(false) // whether to rewrite the link or not
-
- doIndex Boolean @default(false) // we don't index short links by default
-
- // Custom device targeting
- ios String? @db.LongText // custom link for iOS devices
- android String? @db.LongText // custom link for Android devices
- geo Json? @db.Json // custom link for specific countries
-
- // User who created the link
- user User? @relation(fields: [userId], references: [id])
- userId String?
-
- // Project that the link belongs to
- project Project? @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
- projectId String?
- // Relational reference to the project domain
- projectDomain Domain? @relation(fields: [domain], references: [slug], onUpdate: Cascade, onDelete: Cascade)
-
- publicStats Boolean @default(false) // whether to show public stats or not
- clicks Int @default(0) // number of clicks
- lastClicked DateTime? // when the link was last clicked
- leads Int @default(0)
- sales Int @default(0)
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- // Link tags
- tags LinkTag[]
-
- // Comments on the particular shortlink
- comments String? @db.LongText
-
- @@unique([domain, key])
- @@unique([projectId, externalId])
- @@index(projectId)
- @@index(domain)
- @@index(trackConversion)
- @@index(proxy)
- @@index(password)
- @@index(archived)
- @@index(createdAt(sort: Desc))
- @@index(clicks(sort: Desc))
- @@index(lastClicked)
- @@index(userId)
- @@fulltext([key, url])
-}
-
-model Tag {
- id String @id @default(cuid())
- name String
- color String @default("blue")
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
- projectId String
- links LinkTag[]
-
- @@unique([name, projectId])
- @@index(projectId)
-}
-
-model LinkTag {
- id String @id @default(cuid())
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- link Link @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade)
- linkId String
- tag Tag @relation(fields: [tagId], references: [id], onUpdate: Cascade, onDelete: Cascade)
- tagId String
-
- @@unique([linkId, tagId])
- @@index(linkId)
- @@index(tagId)
-}
-
-model Customer {
- id String @id @default(cuid())
- name String?
- email String?
- avatar String?
- externalId String?
- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
- projectId String
- projectConnectId String?
- stripeCustomerId String? @unique
-
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- @@unique([projectId, externalId])
- @@unique([projectConnectId, externalId])
- @@index(projectId)
- @@index(projectConnectId)
- @@index(externalId)
-}
-
-model jackson_index {
- id Int @id @default(autoincrement())
- key String @db.VarChar(250)
- storeKey String @db.VarChar(250)
-
- @@index([key], map: "_jackson_index_key")
- @@index([key, storeKey], map: "_jackson_index_key_store")
-}
-
-model jackson_store {
- key String @id @db.VarChar(250)
- value String @db.Text
- iv String? @db.VarChar(64)
- tag String? @db.VarChar(64)
- namespace String? @db.VarChar(64)
- createdAt DateTime @default(now()) @db.Timestamp(0)
- modifiedAt DateTime? @db.Timestamp(0)
-
- @@index([namespace], map: "_jackson_store_namespace")
-}
-
-model jackson_ttl {
- key String @id @db.VarChar(250)
- expiresAt BigInt
-
- @@index([expiresAt], map: "_jackson_ttl_expires_at")
-}
diff --git a/apps/web/prisma/schema/customer.prisma b/apps/web/prisma/schema/customer.prisma
new file mode 100644
index 0000000000..a9663d3c2a
--- /dev/null
+++ b/apps/web/prisma/schema/customer.prisma
@@ -0,0 +1,20 @@
+model Customer {
+ id String @id @default(cuid())
+ name String?
+ email String?
+ avatar String?
+ externalId String?
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ projectId String
+ projectConnectId String?
+ stripeCustomerId String? @unique
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ @@unique([projectId, externalId])
+ @@unique([projectConnectId, externalId])
+ @@index(projectId)
+ @@index(projectConnectId)
+ @@index(externalId)
+}
\ No newline at end of file
diff --git a/apps/web/prisma/schema/domain.prisma b/apps/web/prisma/schema/domain.prisma
new file mode 100644
index 0000000000..4a2fd3e577
--- /dev/null
+++ b/apps/web/prisma/schema/domain.prisma
@@ -0,0 +1,35 @@
+model Domain {
+ id String @id @default(cuid())
+ slug String @unique
+ verified Boolean @default(false)
+ placeholder String @default("https://dub.co/help/article/what-is-dub")
+ expiredUrl String? @db.LongText // URL to redirect to for expired links
+ primary Boolean @default(false)
+ archived Boolean @default(false)
+ lastChecked DateTime @default(now())
+ links Link[]
+ project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ projectId String?
+
+ // these attributes will exist on both Link and Domain models
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ @@index(projectId)
+ @@index(lastChecked(sort: Asc))
+}
+
+model DefaultDomains {
+ id String @id @default(cuid())
+ dublink Boolean @default(false)
+ dubsh Boolean @default(true)
+ chatgpt Boolean @default(true)
+ sptifi Boolean @default(true)
+ gitnew Boolean @default(true)
+ amznid Boolean @default(true)
+ ggllink Boolean @default(true)
+ figpage Boolean @default(true)
+ loooooooong Boolean @default(false)
+ projectId String @unique
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+}
\ No newline at end of file
diff --git a/apps/web/prisma/schema/jackson.prisma b/apps/web/prisma/schema/jackson.prisma
new file mode 100644
index 0000000000..738b0b3441
--- /dev/null
+++ b/apps/web/prisma/schema/jackson.prisma
@@ -0,0 +1,27 @@
+model jackson_index {
+ id Int @id @default(autoincrement())
+ key String @db.VarChar(250)
+ storeKey String @db.VarChar(250)
+
+ @@index([key], map: "_jackson_index_key")
+ @@index([key, storeKey], map: "_jackson_index_key_store")
+}
+
+model jackson_store {
+ key String @id @db.VarChar(250)
+ value String @db.Text
+ iv String? @db.VarChar(64)
+ tag String? @db.VarChar(64)
+ namespace String? @db.VarChar(64)
+ createdAt DateTime @default(now()) @db.Timestamp(0)
+ modifiedAt DateTime? @db.Timestamp(0)
+
+ @@index([namespace], map: "_jackson_store_namespace")
+}
+
+model jackson_ttl {
+ key String @id @db.VarChar(250)
+ expiresAt BigInt
+
+ @@index([expiresAt], map: "_jackson_ttl_expires_at")
+}
diff --git a/apps/web/prisma/schema/link.prisma b/apps/web/prisma/schema/link.prisma
new file mode 100644
index 0000000000..1d86812b48
--- /dev/null
+++ b/apps/web/prisma/schema/link.prisma
@@ -0,0 +1,73 @@
+model Link {
+ id String @id @default(cuid())
+ domain String // domain of the link (e.g. dub.sh) – also stored on Redis
+ key String // key of the link (e.g. /github) – also stored on Redis
+ url String @db.LongText // target url (e.g. https://github.com/dubinc/dub) – also stored on Redis
+ archived Boolean @default(false) // whether the link is archived or not
+ expiresAt DateTime? // when the link expires – stored on Redis via ttl
+ expiredUrl String? @db.LongText // URL to redirect the user to when the link is expired
+ password String? // password to access the link
+ externalId String?
+
+ trackConversion Boolean @default(false) // whether to track conversions or not
+
+ proxy Boolean @default(false) // Proxy to use custom OG tags (stored on redis) – if false, will use OG tags from target url
+ title String? // OG title for the link (e.g. Dub.co - Open-Source Link Management Infrastructure)
+ description String? @db.VarChar(280) // OG description for the link (e.g. An open-source link management tool for modern marketing teams to create, share, and track short links.)
+ image String? @db.LongText // OG image for the link (e.g. https://d.to/og)
+
+ // UTM parameters
+ utm_source String? // UTM source for the link (e.g. youtube.com)
+ utm_medium String? // UTM medium for the link (e.g. social)
+ utm_campaign String? // UTM campaign for the link (e.g. summer-sale)
+ utm_term String? // UTM term for the link (e.g. dub)
+ utm_content String? // UTM content for the link (e.g. description)
+
+ // Link cloaking/masking via rewrite
+ rewrite Boolean @default(false) // whether to rewrite the link or not
+
+ doIndex Boolean @default(false) // we don't index short links by default
+
+ // Custom device targeting
+ ios String? @db.LongText // custom link for iOS devices
+ android String? @db.LongText // custom link for Android devices
+ geo Json? @db.Json // custom link for specific countries
+
+ // User who created the link
+ user User? @relation(fields: [userId], references: [id])
+ userId String?
+
+ // Project that the link belongs to
+ project Project? @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+ projectId String?
+ // Relational reference to the project domain
+ projectDomain Domain? @relation(fields: [domain], references: [slug], onUpdate: Cascade, onDelete: Cascade)
+
+ publicStats Boolean @default(false) // whether to show public stats or not
+ clicks Int @default(0) // number of clicks
+ lastClicked DateTime? // when the link was last clicked
+ leads Int @default(0)
+ sales Int @default(0)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ // Link tags
+ tags LinkTag[]
+
+ // Comments on the particular shortlink
+ comments String? @db.LongText
+
+ @@unique([domain, key])
+ @@unique([projectId, externalId])
+ @@index(projectId)
+ @@index(domain)
+ @@index(trackConversion)
+ @@index(proxy)
+ @@index(password)
+ @@index(archived)
+ @@index(createdAt(sort: Desc))
+ @@index(clicks(sort: Desc))
+ @@index(lastClicked)
+ @@index(userId)
+ @@fulltext([key, url])
+}
\ No newline at end of file
diff --git a/apps/web/prisma/schema/schema.prisma b/apps/web/prisma/schema/schema.prisma
new file mode 100644
index 0000000000..bf37aaff98
--- /dev/null
+++ b/apps/web/prisma/schema/schema.prisma
@@ -0,0 +1,64 @@
+datasource db {
+ provider = "mysql"
+ url = env("DATABASE_URL")
+ relationMode = "prisma"
+}
+
+generator client {
+ provider = "prisma-client-js"
+ previewFeatures = ["fullTextSearch", "fullTextIndex", "driverAdapters", "prismaSchemaFolder"]
+}
+
+model User {
+ id String @id @default(cuid())
+ name String?
+ email String? @unique
+ emailVerified DateTime?
+ image String?
+ isMachine Boolean @default(false)
+
+ accounts Account[]
+ sessions Session[]
+ projects ProjectUsers[]
+ links Link[]
+ tokens Token[]
+ restrictedTokens RestrictedToken[]
+ createdAt DateTime @default(now())
+ subscribed Boolean @default(true)
+ source String?
+ defaultWorkspace String?
+
+ @@index(source)
+ @@index(defaultWorkspace)
+}
+
+model Account {
+ id String @id @default(cuid())
+ userId String
+ type String
+ provider String
+ providerAccountId String
+ refresh_token String? @db.Text
+ refresh_token_expires_in Int?
+ access_token String? @db.Text
+ expires_at Int?
+ token_type String?
+ scope String?
+ id_token String? @db.Text
+ session_state String?
+
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+
+ @@unique([provider, providerAccountId])
+ @@index([userId])
+}
+
+model Session {
+ id String @id @default(cuid())
+ sessionToken String @unique
+ userId String
+ expires DateTime
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+
+ @@index([userId])
+}
\ No newline at end of file
diff --git a/apps/web/prisma/schema/tag.prisma b/apps/web/prisma/schema/tag.prisma
new file mode 100644
index 0000000000..254fe9cce0
--- /dev/null
+++ b/apps/web/prisma/schema/tag.prisma
@@ -0,0 +1,27 @@
+model Tag {
+ id String @id @default(cuid())
+ name String
+ color String @default("blue")
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+ projectId String
+ links LinkTag[]
+
+ @@unique([name, projectId])
+ @@index(projectId)
+}
+
+model LinkTag {
+ id String @id @default(cuid())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ link Link @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+ linkId String
+ tag Tag @relation(fields: [tagId], references: [id], onUpdate: Cascade, onDelete: Cascade)
+ tagId String
+
+ @@unique([linkId, tagId])
+ @@index(linkId)
+ @@index(tagId)
+}
\ No newline at end of file
diff --git a/apps/web/prisma/schema/token.prisma b/apps/web/prisma/schema/token.prisma
new file mode 100644
index 0000000000..0529b47fe7
--- /dev/null
+++ b/apps/web/prisma/schema/token.prisma
@@ -0,0 +1,43 @@
+model Token {
+ id String @id @default(cuid())
+ name String
+ hashedKey String @unique
+ partialKey String
+ expires DateTime?
+ lastUsed DateTime?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ userId String
+
+ @@index([userId])
+}
+
+model RestrictedToken {
+ id String @id @default(cuid())
+ name String
+ hashedKey String @unique
+ partialKey String
+ scopes String? // space separated (Eg: "links:write", "domains:read")
+ expires DateTime?
+ lastUsed DateTime?
+ rateLimit Int @default(600) // rate limit per minute
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ userId String
+ projectId String
+
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+
+ @@index([userId])
+ @@index([projectId])
+}
+
+model VerificationToken {
+ identifier String
+ token String @unique
+ expires DateTime
+
+ @@unique([identifier, token])
+}
\ No newline at end of file
diff --git a/apps/web/prisma/schema/workspace.prisma b/apps/web/prisma/schema/workspace.prisma
new file mode 100644
index 0000000000..dec5d3bbcf
--- /dev/null
+++ b/apps/web/prisma/schema/workspace.prisma
@@ -0,0 +1,80 @@
+
+
+model Project {
+ id String @id @default(cuid())
+ name String
+ slug String @unique
+ logo String?
+
+ plan String @default("free")
+ stripeId String? @unique // Stripe subscription ID
+ billingCycleStart Int // day of the month when the billing cycle starts
+ stripeConnectId String? @unique // for Stripe Connect
+ inviteCode String? @unique
+
+ usage Int @default(0)
+ usageLimit Int @default(1000)
+ aiUsage Int @default(0)
+ aiLimit Int @default(10)
+ linksUsage Int @default(0)
+ linksLimit Int @default(25)
+ domainsLimit Int @default(3)
+ tagsLimit Int @default(5)
+ usersLimit Int @default(1)
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ usageLastChecked DateTime @default(now())
+
+ users ProjectUsers[]
+ invites ProjectInvite[]
+ sentEmails SentEmail[]
+ links Link[]
+ domains Domain[]
+ tags Tag[]
+ customers Customer[]
+ defaultDomains DefaultDomains[]
+ restrictedTokens RestrictedToken[]
+
+ @@index(usageLastChecked(sort: Asc))
+}
+
+model ProjectInvite {
+ email String
+ expires DateTime
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ projectId String
+ createdAt DateTime @default(now())
+
+ @@unique([email, projectId])
+ @@index([projectId])
+}
+
+enum Role {
+ owner
+ member
+}
+
+model ProjectUsers {
+ id String @id @default(cuid())
+ role Role @default(member)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ userId String
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ projectId String
+
+ @@unique([userId, projectId])
+ @@index([projectId])
+}
+
+model SentEmail {
+ id String @id @default(cuid())
+ type String
+ createdAt DateTime @default(now())
+ project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ projectId String?
+
+ @@index([projectId])
+}
\ No newline at end of file