-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
59 lines (46 loc) · 1.29 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// 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 = "postgres"
url = env("DB_URL")
}
model User {
email String @id @unique
classes ClassForDecks[]
}
model ClassForDecks {
id String @id @default(cuid())
user User @relation(fields: [userEmail], references: [email])
userEmail String
name String
decks Deck[]
creationDate DateTime @default(now())
@@unique([userEmail, name])
}
model Deck {
id String @id @default(cuid())
classOfDeck ClassForDecks @relation(fields: [classId], references: [id], onDelete: Cascade)
classId String
name String
cards Card[]
creationDate DateTime @default(now())
@@unique([classId, name])
}
model Card {
id String @id @unique @default(cuid())
question String
answer String
isDone Boolean @default(false)
videoQuestion String?
videoAnswer String?
imageQuestion String?
imageAnswer String?
deck Deck @relation(fields: [deckId], references: [id], onDelete: Cascade)
deckId String
creationDate DateTime @default(now())
nextReviewDate DateTime
level Int
}