-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.prisma
134 lines (109 loc) · 2.97 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// 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"
binaryTargets = ["native", "linux-musl", "debian-openssl-1.1.x", "darwin-arm64"]
previewFeatures = ["tracing"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum ClusterType {
normal
collection
screenshots
stories
withName
}
model Clusters {
id Int @id @default(autoincrement())
name String @unique
icon String
type ClusterType
sortOrder Int @default(0) // TODO: why?
stories Story[]
Media Media[]
credentials Credentials[]
Tags Tags[]
@@index([name])
}
model Tags {
id Int @id @default(autoincrement())
tag String
icon String?
collapsed Boolean @default(false)
parentId Int?
parent Tags? @relation("ParentChildTags", fields: [parentId], references: [id])
children Tags[] @relation("ParentChildTags")
clusters Clusters[]
media Media[]
}
model Media {
id String @id @default(uuid())
type String
name String
date DateTime @default(now())
createdDate DateTime @default(now())
height Int
width Int
tags_old String[]
source String? // TODO
content_hash String?
favourited Boolean @default(false)
specialFilterAttribute String?
// Link to cluster
cluster Clusters? @relation(fields: [clustersId], references: [id])
clustersId Int
// Grouped with other media
groupedInto GroupedIntoNames? @relation(fields: [groupedIntoNamesId], references: [id])
groupedIntoNamesId Int?
tags Tags[]
@@index([id, clustersId, tags_old])
}
model GroupedIntoNames {
id Int @id @default(autoincrement())
name String
Media Media[]
}
model Story {
id String @id @default(uuid())
cluster Clusters @relation(fields: [clusterId], references: [id])
date DateTime @default(now())
title String
content String
source String @default("Unknown")
clusterId Int
}
model Credentials {
id Int @id @default(autoincrement())
username String @unique
hash String
salt String
permittedClusters Clusters[]
Session Session[]
}
model Session {
id Int @id @default(autoincrement())
token String
createdAt DateTime @default(now())
expiresAt DateTime
credential Credentials @relation(fields: [credentialsId], references: [id])
credentialsId Int
}
enum JobStatus {
created
running
completed
failed
invalid
}
model Job {
id Int @id @default(autoincrement())
name String
status JobStatus @default(created)
data String @default("{}")
completionPercentage Int?
createdAt DateTime @default(now())
priority Int @default(0)
debugMessages String[]
}