generated from Code-the-Dream-School/react-node-practicum-back-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.prisma
73 lines (63 loc) · 2.54 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
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model comments {
comment_id Int @id @default(autoincrement())
user_id Int?
project_id Int?
content String
created_at DateTime? @default(now()) @db.Timestamp(6)
updated_at DateTime? @default(now()) @db.Timestamp(6)
projects projects? @relation(fields: [project_id], references: [project_id], onDelete: Cascade, onUpdate: NoAction)
users users? @relation(fields: [user_id], references: [user_id], onDelete: Cascade, onUpdate: NoAction)
}
model likes {
like_id Int @id @default(autoincrement())
user_id Int?
project_id Int?
created_at DateTime? @default(now()) @db.Timestamp(6)
projects projects? @relation(fields: [project_id], references: [project_id], onDelete: Cascade, onUpdate: NoAction)
users users? @relation(fields: [user_id], references: [user_id], onDelete: Cascade, onUpdate: NoAction)
@@unique([user_id, project_id], map: "unique_like")
}
model projects {
project_id Int @id @default(autoincrement())
name String? @db.VarChar(100)
description String?
github_link String? @db.VarChar(255)
youtube_video_link String? @db.VarChar(255)
is_public Boolean?
created_by Int?
created_at DateTime? @default(now()) @db.Timestamp(6)
tags String[] @default([])
comments comments[]
likes likes[]
users users? @relation(fields: [created_by], references: [user_id], onUpdate: NoAction)
}
model roles {
role_id Int @id @default(autoincrement())
role_name String? @db.VarChar(50)
user_role user_role[] @ignore
}
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
model user_role {
user_id Int
role_id Int
roles roles? @relation(fields: [role_id], references: [role_id], onDelete: Cascade, onUpdate: NoAction)
users users? @relation(fields: [user_id], references: [user_id], onDelete: Cascade, onUpdate: NoAction)
@@id([user_id, role_id]) // Composite primary key (if applicable)
}
model users {
user_id Int @id @default(autoincrement())
username String? @unique @db.VarChar(50)
email String? @unique @db.VarChar(100)
password_hash String? @db.VarChar(255)
comments comments[]
likes likes[]
projects projects[]
user_role user_role[] @ignore
}