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.1 KB
Raw Blame
model Customer {
  id               String  @id
  name             String?
  email            String?
  normalizedEmail  String?
  avatar           String? @db.Text
  externalId       String?
  stripeCustomerId String? @unique

  linkId    String?
  clickId   String?
  clickedAt DateTime?
  country   String?

  sales                  Int       @default(0)
  saleAmount             BigInt    @default(0)
  firstSaleAt            DateTime?
  subscriptionCanceledAt DateTime?

  projectId        String
  projectConnectId String?

  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  project Project @relation(fields: [projectId], references: [id])
  link    Link?   @relation(fields: [linkId], references: [id])

  @@unique([projectId, externalId])
  @@index([projectId, email])
  @@index([projectId, normalizedEmail])
  @@index([projectId, createdAt])
  @@index([projectId, saleAmount])
  @@index([projectId, firstSaleAt])
  @@index([projectId, subscriptionCanceledAt])
  @@index(linkId)
  @@index(country)
  @@fulltext([email, name]) // For full-text search
}