mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 17:41:15 +00:00
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
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())
|
|
}
|
|
|
|
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])
|
|
}
|