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 schema

Kiran K7b0f3d693b4f
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
index 69a9f54e5d..65162f222d 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
@@ -50,7 +50,7 @@ export default function AuthorizedAppsPageClient() {
<div className="flex flex-col items-center justify-center gap-y-4 py-20">
<EmptyState
icon={Key}
- title="You have not yet authorized any applications to connect with your Linear account."
+ title="You have not yet authorized any applications to connect with your Dub workspace."
/>
</div>
)}
diff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prisma
index 599efce97c..89c1e6ca8d 100644
--- a/apps/web/prisma/schema.prisma
+++ b/apps/web/prisma/schema.prisma
@@ -20,17 +20,18 @@ model User {
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?
- oAuthCodes OAuthCode[]
+ accounts Account[]
+ sessions Session[]
+ projects ProjectUsers[]
+ links Link[]
+ tokens Token[]
+ restrictedTokens RestrictedToken[]
+ createdAt DateTime @default(now())
+ subscribed Boolean @default(true)
+ source String?
+ defaultWorkspace String?
+ oAuthCodes OAuthCode[]
+ oAuthAuthorizedApps OAuthAuthorizedApp[] // OAuth clients user authorized for their workspace
@@index(source)
@@index(defaultWorkspace)
@@ -140,17 +141,18 @@ model Project {
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[]
- oAuthClients OAuthClient[]
- oAuthCodes OAuthCode[]
+ users ProjectUsers[]
+ invites ProjectInvite[]
+ sentEmails SentEmail[]
+ links Link[]
+ domains Domain[]
+ tags Tag[]
+ customers Customer[]
+ defaultDomains DefaultDomains[]
+ restrictedTokens RestrictedToken[]
+ oAuthCodes OAuthCode[]
+ oAuthClients OAuthClient[] // OAuth clients workspace published
+ oAuthAuthorizedApps OAuthAuthorizedApp[] // OAuth clients workspace authorized
@@index(usageLastChecked(sort: Asc))
}
@@ -362,7 +364,8 @@ model Customer {
}
model OAuthClient {
- clientId String @id @unique
+ id String @id @default(cuid())
+ clientId String @unique
name String
developer String
website String
@@ -374,10 +377,11 @@ model OAuthClient {
updatedAt DateTime @updatedAt
projectId String
- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
- oAuthCodes OAuthCode[]
- accessTokens RestrictedToken[]
- refreshTokens OAuthRefreshToken[]
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+ oAuthCodes OAuthCode[]
+ accessTokens RestrictedToken[]
+ refreshTokens OAuthRefreshToken[]
+ authorizedApps OAuthAuthorizedApp[]
@@index(projectId)
}
@@ -412,6 +416,20 @@ model OAuthRefreshToken {
@@index(accessTokenId)
}
+model OAuthAuthorizedApp {
+ id String @id @default(cuid())
+ clientId String
+ projectId String // workspace that user granted access to
+ userId String // user who granted access
+ createdAt DateTime @default(now())
+
+ oAuthClient OAuthClient @relation(fields: [clientId], references: [clientId], onDelete: Cascade)
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
+
+ @@unique([clientId, userId, projectId])
+}
+
model jackson_index {
id Int @id @default(autoincrement())
key String @db.VarChar(250)