// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { provider = "prisma-client-js" // previewFeatures = ["referentialIntegrity"] } datasource db { provider = "mysql" // NOTE: When using postgresql, mysql or sqlserver, uncomment the @db.Text annotations in model Account below // Further reading: // https://next-auth.js.org/adapters/prisma#create-the-prisma-schema // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string url = env("DATABASE_URL") // referentialIntegrity = "prisma" relationMode = "prisma" } model Example { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Content { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt roomId String @unique playbackId String streamKey String userId String user User @relation("UserVideo", fields: [userId], references: [id], onDelete: Cascade) @@index([userId]) } model Message { id String @id @default(cuid()) content String roomId String createdAt DateTime @default(now()) authorId String author User @relation("author", fields: [authorId], references: [id], onDelete: Cascade) replyTo String? // author author_ @relation(fields: [authorId], references: [id]) @@index([authorId]) } // Necessary for Next auth model Account { id String @id @default(cuid()) userId String type String provider String providerAccountId String refresh_token String? @db.Text access_token String? @db.Text expires_at Int? token_type String? scope String? id_token String? @db.Text session_state String? // user User user User @relation(fields: [userId], references: [id]) @@unique([provider, providerAccountId]) @@index([userId]) } model Session { id String @id @default(cuid()) sessionToken String @unique userId String expires DateTime user User @relation(fields: [userId], references: [id]) @@index([userId]) } model UserFollows { id String @id @default(cuid()) followerId String followingId String createdAt DateTime @default(now()) follower User @relation("FollowerRelation", fields: [followerId], references: [id]) following User @relation("FollowingRelation", fields: [followingId], references: [id]) @@unique([followerId, followingId]) @@index([followingId]) } model User { id String @id @default(cuid()) name String? email String? @unique emailVerified DateTime? image String? chatColor String? accounts Account[] sessions Session[] messages Message[] @relation("author") // roomId String? @unique videos Content[] @relation("UserVideo") following UserFollows[] @relation("FollowerRelation") followers UserFollows[] @relation("FollowingRelation") } model VerificationToken { identifier String token String @unique expires DateTime @@unique([identifier, token]) }