Last active
September 21, 2021 03:59
-
-
Save aryaminus/91479b87c43346fbfb0e03a92de559f5 to your computer and use it in GitHub Desktop.
Basic Setup Configuration
This file contains hidden or 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
| generator client { | |
| provider = "prisma-client-js" | |
| } | |
| datasource db { | |
| provider = "postgresql" | |
| url = env("DATABASE_URL") | |
| } | |
| model User { | |
| id String @id @default(cuid()) | |
| createdAt DateTime @default(now()) | |
| updatedAt DateTime @updatedAt | |
| email String @unique | |
| name String? | |
| googleId String? @unique | |
| facebookId String? @unique | |
| appleId String? @unique | |
| password String? | |
| username String? @unique | |
| avatar String? | |
| gender String? | |
| isPasswordSet Boolean @default(false) | |
| isProfileComplete Boolean @default(false) | |
| currentState CurrentStateCase @default(ONLINE) | |
| connectionFriend Connection? @relation("ConnectionToFriend") | |
| connection Connection? | |
| message Message[] | |
| conversationAdmin Conversation[] @relation("ConversationToAdmin") | |
| conversation Conversation[] | |
| } | |
| model Connection { | |
| id Int @id @default(autoincrement()) | |
| createdAt DateTime @default(now()) | |
| updatedAt DateTime @updatedAt | |
| userId String @unique | |
| friendId String @unique | |
| conversationId Int? | |
| case ConnectionFriendCase @default(NOT_REQUESTED) | |
| conversation Conversation? @relation(fields: [conversationId], references: [id]) | |
| friend User @relation("ConnectionToFriend", fields: [friendId], references: [id]) | |
| user User @relation(fields: [userId], references: [id]) | |
| } | |
| model Conversation { | |
| id Int @id @default(autoincrement()) | |
| createdAt DateTime @default(now()) | |
| updatedAt DateTime @updatedAt | |
| name String? | |
| isGroup Boolean @default(false) | |
| connections Connection[] | |
| messages Message[] | |
| admins User[] @relation("ConversationToAdmin") | |
| users User[] | |
| } | |
| model Message { | |
| id Int @id @default(autoincrement()) | |
| createdAt DateTime @default(now()) | |
| updatedAt DateTime @updatedAt | |
| userId String | |
| conversationId Int | |
| text String | |
| conversation Conversation @relation(fields: [conversationId], references: [id]) | |
| user User @relation(fields: [userId], references: [id]) | |
| } | |
| enum CurrentStateCase { | |
| ONLINE | |
| OFFLINE | |
| } | |
| enum ConnectionFriendCase { | |
| NOT_REQUESTED | |
| REQUESTED | |
| ACCEPTED | |
| REJECTED | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment