Spaces:
Running
Running
Commit
·
c792d09
1
Parent(s):
f3db631
db pull
Browse files- prisma/schema.prisma +13 -19
prisma/schema.prisma
CHANGED
@@ -1,25 +1,19 @@
|
|
1 |
-
// This is your Prisma schema file,
|
2 |
-
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
3 |
-
|
4 |
-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
5 |
-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
6 |
-
|
7 |
generator client {
|
8 |
provider = "prisma-client-js"
|
9 |
}
|
10 |
|
11 |
datasource db {
|
12 |
provider = "postgresql"
|
13 |
-
url = env("POSTGRES_PRISMA_URL")
|
14 |
-
directUrl = env("POSTGRES_URL_NON_POOLING")
|
15 |
}
|
16 |
|
17 |
model User {
|
18 |
id String @id @default(cuid())
|
19 |
name String
|
20 |
email String @unique
|
21 |
-
createdAt DateTime @default(now()) @map(
|
22 |
-
updatedAt DateTime @updatedAt @map(
|
23 |
chats Chat[]
|
24 |
message Message[]
|
25 |
|
@@ -28,11 +22,11 @@ model User {
|
|
28 |
|
29 |
model Chat {
|
30 |
id String @id @default(cuid())
|
|
|
|
|
|
|
31 |
mediaUrl String
|
32 |
-
createdAt DateTime @default(now()) @map(name: "created_at")
|
33 |
-
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
34 |
user User? @relation(fields: [userId], references: [id])
|
35 |
-
userId String?
|
36 |
messages Message[]
|
37 |
|
38 |
@@map("chat")
|
@@ -40,14 +34,14 @@ model Chat {
|
|
40 |
|
41 |
model Message {
|
42 |
id String @id @default(cuid())
|
43 |
-
|
44 |
-
|
45 |
-
createdAt DateTime @default(now()) @map(name: "created_at")
|
46 |
-
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
47 |
-
user User? @relation(fields: [userId], references: [id])
|
48 |
userId String?
|
49 |
-
chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
|
50 |
chatId String
|
|
|
|
|
|
|
|
|
51 |
|
52 |
@@map("message")
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
generator client {
|
2 |
provider = "prisma-client-js"
|
3 |
}
|
4 |
|
5 |
datasource db {
|
6 |
provider = "postgresql"
|
7 |
+
url = env("POSTGRES_PRISMA_URL")
|
8 |
+
directUrl = env("POSTGRES_URL_NON_POOLING")
|
9 |
}
|
10 |
|
11 |
model User {
|
12 |
id String @id @default(cuid())
|
13 |
name String
|
14 |
email String @unique
|
15 |
+
createdAt DateTime @default(now()) @map("created_at")
|
16 |
+
updatedAt DateTime @updatedAt @map("updated_at")
|
17 |
chats Chat[]
|
18 |
message Message[]
|
19 |
|
|
|
22 |
|
23 |
model Chat {
|
24 |
id String @id @default(cuid())
|
25 |
+
createdAt DateTime @default(now()) @map("created_at")
|
26 |
+
updatedAt DateTime @updatedAt @map("updated_at")
|
27 |
+
userId String?
|
28 |
mediaUrl String
|
|
|
|
|
29 |
user User? @relation(fields: [userId], references: [id])
|
|
|
30 |
messages Message[]
|
31 |
|
32 |
@@map("chat")
|
|
|
34 |
|
35 |
model Message {
|
36 |
id String @id @default(cuid())
|
37 |
+
createdAt DateTime @default(now()) @map("created_at")
|
38 |
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
|
|
|
39 |
userId String?
|
|
|
40 |
chatId String
|
41 |
+
content String
|
42 |
+
role MessageRole
|
43 |
+
chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
|
44 |
+
user User? @relation(fields: [userId], references: [id])
|
45 |
|
46 |
@@map("message")
|
47 |
}
|