forked from blinko-space/blinko
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
113 lines (98 loc) · 3.56 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
generator client {
provider = "prisma-client-js"
}
// generator zod {
// provider = "zod-prisma-types"
// }
datasource db {
provider = "postgres"
url = env("DATABASE_URL")
}
model accounts {
id Int @id @default(autoincrement())
name String @default("") @db.VarChar
nickname String @default("") @db.VarChar
password String @default("") @db.VarChar
image String @default("") @db.VarChar
apiToken String @default("") @db.VarChar
note Int @default(0)
role String @default("") @db.VarChar
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @updatedAt @db.Timestamptz(6)
notes notes[]
configs config[]
}
model attachments {
id Int @id @default(autoincrement())
isShare Boolean @default(false)
sharePassword String @default("") @db.VarChar
name String @default("") @db.VarChar
path String @default("") @db.VarChar
size Decimal @default(0) @db.Decimal
type String @default("") @db.VarChar
noteId Int @default(0)
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @updatedAt @db.Timestamptz(6)
note notes @relation(fields: [noteId], references: [id])
}
model config {
id Int @id @default(autoincrement())
key String @default("") @db.VarChar
config Json? @db.Json
userId Int?
user accounts? @relation(fields: [userId], references: [id])
}
model notes {
id Int @id @default(autoincrement())
type Int @default(0)
content String @default("") @db.VarChar
isArchived Boolean @default(false)
isRecycle Boolean @default(false)
isShare Boolean @default(false)
isTop Boolean @default(false)
isReviewed Boolean @default(false)
sharePassword String @default("") @db.VarChar
metadata Json? @db.Json
accountId Int?
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @updatedAt @db.Timestamptz(6)
attachments attachments[]
tags tagsToNote[]
account accounts? @relation(fields: [accountId], references: [id])
referencedBy noteReference[] @relation("ReferencedNote")
references noteReference[] @relation("ReferencingNote")
}
model tag {
id Int @id @default(autoincrement())
name String @default("") @db.VarChar
icon String @default("") @db.VarChar
parent Int @default(0)
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @updatedAt @db.Timestamptz(6)
tagsToNote tagsToNote[]
}
model tagsToNote {
id Int @default(autoincrement())
noteId Int @default(0)
tagId Int @default(0)
note notes @relation(fields: [noteId], references: [id])
tag tag @relation(fields: [tagId], references: [id])
@@id([noteId, tagId])
}
model scheduledTask {
name String @id
schedule String
lastRun DateTime @default(now())
isSuccess Boolean @default(true)
isRunning Boolean @default(false)
output Json? @db.Json
}
model noteReference {
id Int @id @default(autoincrement())
fromNoteId Int
toNoteId Int
createdAt DateTime @default(now()) @db.Timestamptz(6)
fromNote notes @relation("ReferencingNote", fields: [fromNoteId], references: [id])
toNote notes @relation("ReferencedNote", fields: [toNoteId], references: [id])
@@unique([fromNoteId, toNoteId])
}