Building the database

// Prismadb 

model Purchase {
  id String @id @default(uuid())
  userId String

  courseId String
  course Course @relation(fields: [courseId], references: [id], onDelete: Cascade)

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

  @@unique([userId, courseId])
  @@index([courseId])
}

model StripeCustomer {
  id String @id @default(uuid())
  userId String @unique
  stripeCustomerId String @unique

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