// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { provider = "prisma-client-js" } datasource db { provider = "mongodb" url = env("DATABASE_URL") } model User{ id String @id @default(auto()) @map("_id") @db.ObjectId email String username String password String role Int @default(0) tickets Ticket[] } model Events{ id String @id @default(auto()) @map("_id") @db.ObjectId title String location String date DateTime image String tickets Ticket[] ttype TicketType[] } model TicketType { id String @id @default(auto()) @map("_id") @db.ObjectId event Events @relation(fields: [eventId], references: [id], onDelete: Cascade) eventId String @db.ObjectId name String price Float qty Int tickets Ticket[] } model Ticket{ id String @id @default(auto()) @map("_id") @db.ObjectId ticketnr String @unique user User? @relation(fields: [userId], references: [id], onDelete:Cascade) userId String? @db.ObjectId event Events @relation(fields: [eventId], references: [id], onDelete: Cascade) eventId String @db.ObjectId ttype TicketType @relation(fields: [ttypeId], references: [id], onDelete: Cascade) ttypeId String @db.ObjectId status Int @default(0) scandate DateTime? }