project-knedita/prisma/schema.prisma

50 lines
1.3 KiB
Text
Raw Normal View History

2023-06-20 20:05:15 +00:00
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
displayName String?
username String @unique
email String @unique
password String
posts Post[]
profileImage String?
likedPosts Like[]
followers Follows[] @relation("following")
following Follows[] @relation("follower")
createdAt DateTime @default(now())
2023-06-20 20:05:15 +00:00
}
model Post {
id String @id @default(uuid())
content String
authorId String
author User @relation(fields: [authorId], references: [id])
likes Like[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Like {
id String @id @default(uuid())
postId String
post Post @relation(fields: [postId], references: [id])
userId String
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
}
model Follows {
follower User @relation("follower", fields: [followerId], references: [id])
followerId String
following User @relation("following", fields: [followingId], references: [id])
followingId String
@@id([followerId, followingId])
}