-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
120 lines (107 loc) · 3.41 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Creator {
id String @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz(6)
name String @default("")
bio String @default("")
picture String @default("")
platforms CreatorPlatform[]
}
enum Platform {
youtube
}
model CreatorPlatform {
id String @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz(6)
platform Platform?
url String? @unique
externalId String? @unique
creatorId String? @db.Uuid
creator Creator? @relation(fields: [creatorId], references: [id])
videos Video[]
}
model Trick {
id String @id @unique
createdAt DateTime @default(now()) @db.Timestamptz(6)
name String
preview String? @default("")
difficulty TrickDifficulty? @default(others)
draft Boolean @default(true)
tags Tag[]
videos Video[]
prerequisites Trick[] @relation("Prerequisite")
next Trick[] @relation("Prerequisite")
savedTricks SavedTrick[]
}
model SavedTrick {
id String @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
user User @relation(fields: [userId], references: [id])
trick Trick @relation(fields: [trickId], references: [id])
createdAt DateTime @default(now()) @db.Timestamptz(6)
category String
userId String @db.Uuid
trickId String
}
model User {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz(6)
email String @unique
picture String?
savedTricks SavedTrick[]
contributions Contribution[]
}
model Video {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz(6)
externalId String @unique
source String @default("others")
trickId String?
title String @default("")
trick Trick? @relation(fields: [trickId], references: [id], onDelete: NoAction, onUpdate: NoAction)
creatorPlatform CreatorPlatform? @relation(fields: [creatorPlatformId], references: [id])
creatorPlatformId String? @db.Uuid
}
enum ContributionStatus {
waiting
rejected
approved
cancelled
}
enum ContributionAction {
add
remove
update
publish
connect
disconnect
}
model Contribution {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz(6)
entity String
entityId String
key String
value String
action ContributionAction
author User @relation(fields: [authorId], references: [id])
authorId String @db.Uuid
}
model Tag {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz(6)
name String @unique
tricks Trick[]
}
enum TrickDifficulty {
others
beginner
intermediate
basics
advanced
}