-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathschema.prisma
113 lines (97 loc) · 2.82 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
// 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-arm64-openssl-3.0.x"]
}
datasource db {
provider = "postgresql"
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
}
model User {
id String @id @default(cuid())
username String @unique
auth_session Session[]
key Key[]
}
model Session {
id String @id @unique
user_id String
active_expires BigInt
idle_expires BigInt
user User @relation(references: [id], fields: [user_id], onDelete: Cascade)
@@index([user_id])
}
model Key {
id String @id @unique
hashed_password String?
user_id String
user User @relation(references: [id], fields: [user_id], onDelete: Cascade)
@@index([user_id])
}
model Protocol {
id String @id @default(cuid())
hash String @unique
name String
schemaVersion Int
description String?
importedAt DateTime @default(now())
lastModified DateTime
stages Json
codebook Json
assets Asset[]
interviews Interview[]
}
model Asset {
key String @id
assetId String @unique
name String
type String
url String
size Int
protocols Protocol[]
@@index(fields: [assetId, key])
}
model Interview {
id String @id @default(cuid()) // Cannot be bigint because we want to obfuscate the id
startTime DateTime @default(now())
finishTime DateTime?
exportTime DateTime?
lastUpdated DateTime @updatedAt
network Json
participant Participant @relation(fields: [participantId], references: [id], onDelete: Cascade)
participantId String
protocol Protocol @relation(fields: [protocolId], references: [id], onDelete: Cascade)
protocolId String @map("protocolId")
currentStep Int @default(0)
stageMetadata Json? // Used to store negative responses in tiestrength census and dyadcensus
@@index(fields: [protocolId])
@@index([participantId])
}
model Participant {
id String @id @unique @default(cuid())
identifier String @unique
label String?
interviews Interview[]
}
// Cant be shared with TS, unfortunately. Ensure `./schemas/appSettings.ts` is in sync
enum AppSetting {
configured
allowAnonymousRecruitment
limitInterviews
initializedAt
installationId
disableAnalytics
uploadThingToken
}
model AppSettings {
key AppSetting @unique
value String
}
model Events {
id String @id @default(cuid())
timestamp DateTime @default(now())
type String
message String
}