2023-06-20 20:05:15 +00:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2023-07-17 20:47:05 +00:00
|
|
|
id String @id @default(uuid())
|
|
|
|
displayName String?
|
|
|
|
username String @unique
|
|
|
|
email String @unique
|
|
|
|
password String
|
|
|
|
posts Post[]
|
|
|
|
profileImage String?
|
2023-07-25 13:57:23 +00:00
|
|
|
likedPosts Like[]
|
|
|
|
followers Follows[] @relation("following")
|
|
|
|
following Follows[] @relation("follower")
|
2023-07-17 20:47:05 +00:00
|
|
|
createdAt DateTime @default(now())
|
2023-06-20 20:05:15 +00:00
|
|
|
}
|
2023-06-23 18:15:11 +00:00
|
|
|
|
|
|
|
model Post {
|
|
|
|
id String @id @default(uuid())
|
|
|
|
content String
|
|
|
|
authorId String
|
|
|
|
author User @relation(fields: [authorId], references: [id])
|
2023-07-25 13:57:23 +00:00
|
|
|
likes Like[]
|
2023-06-23 18:15:11 +00:00
|
|
|
createdAt DateTime @default(now())
|
2023-06-27 23:24:26 +00:00
|
|
|
updatedAt DateTime @updatedAt
|
2023-07-25 13:57:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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])
|
|
|
|
}
|