-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87748d5
commit ad6ad71
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// 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 = "mongodb" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model User { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
email String? @unique | ||
name String? | ||
username String? @unique | ||
bio String? | ||
emailVerified DateTime? | ||
image String? | ||
coverImage String? | ||
profileImage String? | ||
hashedPassword String? | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
followingIds String[] @db.ObjectId | ||
hasNotification Boolean? | ||
posts Post[] | ||
comments Comment[] | ||
notifications Notification[] | ||
} | ||
|
||
model Post { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
body String | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
userId String @db.ObjectId | ||
likedIds String[] @db.ObjectId | ||
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | ||
comments Comment[] | ||
} | ||
|
||
model Comment { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
body String | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
userId String @db.ObjectId | ||
postId String @db.ObjectId | ||
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | ||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade) | ||
} | ||
|
||
model Notification { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
body String | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
userId String @db.ObjectId | ||
user User @relation(fields: [userId], references: [id], onDelete: Cascade) | ||
} |