// 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" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) userName String? @unique name String? @default("u ${id}") email String? @unique password String emailVerified DateTime? image String? createdAt DateTime @default(now()) Post Post[] Comment Comment[] Like Like[] followers Follows[] @relation("follower") following Follows[] @relation("following") } model Follows { follower User @relation("following", fields: [followerId], references: [id]) followerId Int following User @relation("follower", fields: [followingId], references: [id]) followingId Int createdAt DateTime @default(now()) @@id([followerId, followingId]) } model Post { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt content String likeCount Int? @default(0) gameId Int? published Boolean @default(false) userId Int user User @relation(fields: [userId], references: [id], onDelete: Cascade) Comment Comment[] Like Like[] } model Like { id Int @id @default(autoincrement()) postId Int userId Int post Post @relation(fields: [postId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade) } model Comment { id Int @id @default(autoincrement()) message String postId Int userId Int createdAt DateTime @default(now()) post Post @relation(fields: [postId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade) }