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.

1.7 KB
Raw Blame
model Integration {
  id          String   @id @default(cuid())
  userId      String?
  projectId   String
  name        String
  slug        String   @unique
  description String?
  readme      String?  @db.LongText
  developer   String
  website     String
  logo        String?
  screenshots Json?
  verified    Boolean  @default(false)
  installUrl  String?  @db.Text
  guideUrl    String?  @db.Text
  category    String?
  comingSoon  Boolean  @default(false)
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt

  user          User?                  @relation(fields: [userId], references: [id], onDelete: SetNull)
  project       Project                @relation(fields: [projectId], references: [id], onDelete: Cascade)
  oAuthApp      OAuthApp?
  installations InstalledIntegration[]

  @@index(projectId)
  @@index(userId)
}

model InstalledIntegration {
  id            String   @id @default(cuid())
  userId        String // user who installed the integration
  integrationId String // integration that was installed
  projectId     String // workspace where integration was installed
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt
  credentials   Json?
  settings      Json?

  user          User                @relation(fields: [userId], references: [id], onDelete: Cascade)
  integration   Integration         @relation(fields: [integrationId], references: [id], onDelete: Cascade)
  project       Project             @relation(fields: [projectId], references: [id], onDelete: Cascade)
  refreshTokens OAuthRefreshToken[]
  accessTokens  RestrictedToken[]
  webhooks      Webhook[]

  @@unique([userId, integrationId, projectId])
  @@index(projectId)
  @@index(integrationId)
}