-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
93 lines (84 loc) · 3.24 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
// 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"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
// model Voter {
// id String @id @default(cuid())
// createdAt DateTime? @default(now())
// name String
// address String
// }
model User {
id String @id @default(cuid())
createdAt DateTime? @default(now())
name String?
address String @unique
nonce String? @db.VarChar(255)
apiKey String? @db.VarChar(255)
roles UserRole[]
proposal Proposal[]
project Project[]
votes Votes[]
}
model UserRole {
id String @id @default(cuid())
name String @unique
permissions Json?
users User[]
}
model Proposal {
id String @id @default(cuid())
createdAt DateTime? @default(now())
startAt DateTime? @default(now())
endAt DateTime?
title String @db.Text
description String? @db.Text
status EnumProposalStatus?
project Project @relation(fields: [projectId], references: [id])
projectId String
user User @relation(fields: [userId], references: [id])
userId String
votes Votes[]
}
model Category {
id String @id @default(cuid())
createdAt DateTime? @default(now())
title String @db.Text
slug String @unique
projects Project[]
}
model Project {
id String @id @default(cuid())
createdAt DateTime? @default(now())
title String
slug String @unique
iconImage String?
shortDescription String? @db.LongText
fullDescription String? @db.LongText
status EnumProposalStatus?
categories Category[]
proposals Proposal[]
user User @relation(fields: [userId], references: [id])
userId String
}
model Votes {
id String @id @default(cuid())
address String
choice String?
user User @relation(fields: [userId], references: [id])
userId String
proposal Proposal @relation(fields: [proposalId], references: [id])
proposalId String
}
enum EnumProposalStatus {
Active
Pending
Closed
}