@virtality/schema 0.0.1-alpha.0.2 → 0.0.1-alpha.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `avatarId` on the `Patient` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropForeignKey
|
|
8
|
+
ALTER TABLE "Account" DROP CONSTRAINT "account_userId_fkey";
|
|
9
|
+
|
|
10
|
+
-- DropForeignKey
|
|
11
|
+
ALTER TABLE "Device" DROP CONSTRAINT "devices_userId_fkey";
|
|
12
|
+
|
|
13
|
+
-- DropForeignKey
|
|
14
|
+
ALTER TABLE "Invitation" DROP CONSTRAINT "invitation_inviterId_fkey";
|
|
15
|
+
|
|
16
|
+
-- DropForeignKey
|
|
17
|
+
ALTER TABLE "Invitation" DROP CONSTRAINT "invitation_organizationId_fkey";
|
|
18
|
+
|
|
19
|
+
-- DropForeignKey
|
|
20
|
+
ALTER TABLE "Member" DROP CONSTRAINT "member_organizationId_fkey";
|
|
21
|
+
|
|
22
|
+
-- DropForeignKey
|
|
23
|
+
ALTER TABLE "Member" DROP CONSTRAINT "member_userId_fkey";
|
|
24
|
+
|
|
25
|
+
-- DropForeignKey
|
|
26
|
+
ALTER TABLE "Patient" DROP CONSTRAINT "Patient_avatarId_fkey";
|
|
27
|
+
|
|
28
|
+
-- DropForeignKey
|
|
29
|
+
ALTER TABLE "PatientProgram" DROP CONSTRAINT "PatientProgram_userId_fkey";
|
|
30
|
+
|
|
31
|
+
-- DropForeignKey
|
|
32
|
+
ALTER TABLE "PatientSession" DROP CONSTRAINT "PatientSession_programId_fkey";
|
|
33
|
+
|
|
34
|
+
-- DropForeignKey
|
|
35
|
+
ALTER TABLE "ProgramExercise" DROP CONSTRAINT "program_exercises_programId_fkey";
|
|
36
|
+
|
|
37
|
+
-- DropForeignKey
|
|
38
|
+
ALTER TABLE "Session" DROP CONSTRAINT "session_userId_fkey";
|
|
39
|
+
|
|
40
|
+
-- DropForeignKey
|
|
41
|
+
ALTER TABLE "SessionData" DROP CONSTRAINT "SessionData_sessionExerciseId_fkey";
|
|
42
|
+
|
|
43
|
+
-- DropForeignKey
|
|
44
|
+
ALTER TABLE "SessionExercise" DROP CONSTRAINT "SessionExercise_patientSessionId_fkey";
|
|
45
|
+
|
|
46
|
+
-- AlterTable
|
|
47
|
+
ALTER TABLE "Patient" DROP COLUMN "avatarId",
|
|
48
|
+
ADD COLUMN "deletedAt" TIMESTAMP(6),
|
|
49
|
+
ADD COLUMN "history" TEXT;
|
|
50
|
+
|
|
51
|
+
-- AlterTable
|
|
52
|
+
ALTER TABLE "PatientSession" ALTER COLUMN "programId" DROP NOT NULL;
|
|
53
|
+
|
|
54
|
+
-- AlterTable
|
|
55
|
+
ALTER TABLE "SessionData" ALTER COLUMN "sessionExerciseId" DROP NOT NULL;
|
|
56
|
+
|
|
57
|
+
-- AlterTable
|
|
58
|
+
ALTER TABLE "SessionExercise" ALTER COLUMN "patientSessionId" DROP NOT NULL;
|
|
59
|
+
|
|
60
|
+
-- AlterTable
|
|
61
|
+
ALTER TABLE "User" ADD COLUMN "deletedAt" TIMESTAMP(6);
|
|
62
|
+
|
|
63
|
+
-- AddForeignKey
|
|
64
|
+
ALTER TABLE "Account" ADD CONSTRAINT "account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
65
|
+
|
|
66
|
+
-- AddForeignKey
|
|
67
|
+
ALTER TABLE "Device" ADD CONSTRAINT "devices_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
68
|
+
|
|
69
|
+
-- AddForeignKey
|
|
70
|
+
ALTER TABLE "Invitation" ADD CONSTRAINT "invitation_inviterId_fkey" FOREIGN KEY ("inviterId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
71
|
+
|
|
72
|
+
-- AddForeignKey
|
|
73
|
+
ALTER TABLE "Invitation" ADD CONSTRAINT "invitation_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
74
|
+
|
|
75
|
+
-- AddForeignKey
|
|
76
|
+
ALTER TABLE "Member" ADD CONSTRAINT "member_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
77
|
+
|
|
78
|
+
-- AddForeignKey
|
|
79
|
+
ALTER TABLE "Member" ADD CONSTRAINT "member_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
80
|
+
|
|
81
|
+
-- AddForeignKey
|
|
82
|
+
ALTER TABLE "PatientProgram" ADD CONSTRAINT "PatientProgram_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
83
|
+
|
|
84
|
+
-- AddForeignKey
|
|
85
|
+
ALTER TABLE "ProgramExercise" ADD CONSTRAINT "program_exercises_programId_fkey" FOREIGN KEY ("programId") REFERENCES "PatientProgram"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
86
|
+
|
|
87
|
+
-- AddForeignKey
|
|
88
|
+
ALTER TABLE "Session" ADD CONSTRAINT "session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
89
|
+
|
|
90
|
+
-- AddForeignKey
|
|
91
|
+
ALTER TABLE "PatientSession" ADD CONSTRAINT "PatientSession_programId_fkey" FOREIGN KEY ("programId") REFERENCES "PatientProgram"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
92
|
+
|
|
93
|
+
-- AddForeignKey
|
|
94
|
+
ALTER TABLE "SessionExercise" ADD CONSTRAINT "SessionExercise_patientSessionId_fkey" FOREIGN KEY ("patientSessionId") REFERENCES "PatientSession"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
95
|
+
|
|
96
|
+
-- AddForeignKey
|
|
97
|
+
ALTER TABLE "SessionData" ADD CONSTRAINT "SessionData_sessionExerciseId_fkey" FOREIGN KEY ("sessionExerciseId") REFERENCES "SessionExercise"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -22,19 +22,19 @@ model Account {
|
|
|
22
22
|
password String?
|
|
23
23
|
createdAt DateTime @db.Timestamp(6)
|
|
24
24
|
updatedAt DateTime @db.Timestamp(6)
|
|
25
|
-
user User @relation(fields: [userId], references: [id], onDelete:
|
|
25
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "account_userId_fkey")
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
model Device {
|
|
29
29
|
id String @id(map: "devices_pkey")
|
|
30
|
-
deviceId String?
|
|
31
30
|
userId String
|
|
31
|
+
deviceId String?
|
|
32
32
|
model String?
|
|
33
33
|
lastUsed DateTime @db.Timestamp(6)
|
|
34
34
|
createdAt DateTime @db.Timestamp(6)
|
|
35
35
|
deletedAt DateTime? @db.Timestamp(6)
|
|
36
36
|
name String
|
|
37
|
-
user User @relation(fields: [userId], references: [id], onDelete:
|
|
37
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "devices_userId_fkey")
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
model Exercise {
|
|
@@ -60,8 +60,8 @@ model Invitation {
|
|
|
60
60
|
status String
|
|
61
61
|
expiresAt DateTime @db.Timestamp(6)
|
|
62
62
|
inviterId String
|
|
63
|
-
user User @relation(fields: [inviterId], references: [id], onDelete:
|
|
64
|
-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade,
|
|
63
|
+
user User @relation(fields: [inviterId], references: [id], onDelete: Cascade, map: "invitation_inviterId_fkey")
|
|
64
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, map: "invitation_organizationId_fkey")
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
model Member {
|
|
@@ -70,8 +70,8 @@ model Member {
|
|
|
70
70
|
userId String
|
|
71
71
|
role String
|
|
72
72
|
createdAt DateTime @db.Timestamp(6)
|
|
73
|
-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade,
|
|
74
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade,
|
|
73
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, map: "member_organizationId_fkey")
|
|
74
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "member_userId_fkey")
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
model Organization {
|
|
@@ -89,29 +89,35 @@ model Organization {
|
|
|
89
89
|
|
|
90
90
|
model Patient {
|
|
91
91
|
id String @id(map: "patients_pkey")
|
|
92
|
-
userId String?
|
|
93
92
|
name String
|
|
93
|
+
userId String?
|
|
94
94
|
email String?
|
|
95
95
|
phone String?
|
|
96
96
|
dob String?
|
|
97
97
|
sex String?
|
|
98
98
|
weight String?
|
|
99
99
|
height String?
|
|
100
|
+
history String?
|
|
101
|
+
language Language @default(Greek)
|
|
102
|
+
image String? @unique
|
|
100
103
|
createdAt DateTime @default(now()) @db.Timestamp(6)
|
|
101
104
|
updatedAt DateTime @default(now()) @db.Timestamp(6)
|
|
102
|
-
|
|
103
|
-
image String? @unique
|
|
104
|
-
avatar Avatar? @relation(fields: [avatarId], references: [id])
|
|
105
|
+
deletedAt DateTime? @db.Timestamp(6)
|
|
105
106
|
patientProgram PatientProgram[]
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
enum Language {
|
|
110
|
+
Greek
|
|
111
|
+
English
|
|
112
|
+
}
|
|
113
|
+
|
|
108
114
|
model PatientProgram {
|
|
109
115
|
id String @id(map: "patient_program_pkey")
|
|
110
116
|
name String
|
|
111
117
|
userId String
|
|
112
118
|
patientId String
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
|
120
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
115
121
|
patientSession PatientSession[]
|
|
116
122
|
programExercise ProgramExercise[]
|
|
117
123
|
}
|
|
@@ -126,7 +132,7 @@ model ProgramExercise {
|
|
|
126
132
|
holdTime Int @default(1)
|
|
127
133
|
speed Float @default(1)
|
|
128
134
|
exercise Exercise @relation(fields: [exerciseId], references: [id])
|
|
129
|
-
patientProgram PatientProgram @relation(fields: [programId], references: [id], onDelete: Cascade,
|
|
135
|
+
patientProgram PatientProgram @relation(fields: [programId], references: [id], onDelete: Cascade, map: "program_exercises_programId_fkey")
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
model Session {
|
|
@@ -140,7 +146,7 @@ model Session {
|
|
|
140
146
|
userId String
|
|
141
147
|
activeOrganizationId String?
|
|
142
148
|
impersonatedBy String?
|
|
143
|
-
user User @relation(fields: [userId], references: [id], onDelete:
|
|
149
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "session_userId_fkey")
|
|
144
150
|
}
|
|
145
151
|
|
|
146
152
|
model User {
|
|
@@ -151,6 +157,7 @@ model User {
|
|
|
151
157
|
image String? @unique
|
|
152
158
|
createdAt DateTime @db.Timestamp(6)
|
|
153
159
|
updatedAt DateTime @db.Timestamp(6)
|
|
160
|
+
deletedAt DateTime? @db.Timestamp(6)
|
|
154
161
|
phone String?
|
|
155
162
|
stripeCustomerId String?
|
|
156
163
|
banExpires DateTime?
|
|
@@ -175,10 +182,9 @@ model Verification {
|
|
|
175
182
|
}
|
|
176
183
|
|
|
177
184
|
model Avatar {
|
|
178
|
-
id
|
|
179
|
-
name
|
|
180
|
-
image
|
|
181
|
-
Patient Patient[]
|
|
185
|
+
id String @id
|
|
186
|
+
name String
|
|
187
|
+
image String? @unique
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
model Map {
|
|
@@ -189,17 +195,17 @@ model Map {
|
|
|
189
195
|
|
|
190
196
|
model PatientSession {
|
|
191
197
|
id String @id
|
|
192
|
-
programId String
|
|
198
|
+
programId String?
|
|
193
199
|
createdAt DateTime @db.Timestamp(6)
|
|
194
200
|
completedAt DateTime? @db.Timestamp(6)
|
|
195
201
|
deletedAt DateTime? @db.Timestamp(6)
|
|
196
|
-
program PatientProgram
|
|
202
|
+
program PatientProgram? @relation(fields: [programId], references: [id], onDelete: SetNull)
|
|
197
203
|
sessionExercise SessionExercise[]
|
|
198
204
|
}
|
|
199
205
|
|
|
200
206
|
model SessionExercise {
|
|
201
|
-
id String
|
|
202
|
-
patientSessionId String
|
|
207
|
+
id String @id
|
|
208
|
+
patientSessionId String?
|
|
203
209
|
exerciseId String
|
|
204
210
|
sets Int
|
|
205
211
|
reps Int
|
|
@@ -207,15 +213,15 @@ model SessionExercise {
|
|
|
207
213
|
holdTime Int
|
|
208
214
|
speed Float
|
|
209
215
|
sessionData SessionData[]
|
|
210
|
-
exercise Exercise
|
|
211
|
-
patientSession PatientSession @relation(fields: [patientSessionId], references: [id])
|
|
216
|
+
exercise Exercise @relation(fields: [exerciseId], references: [id])
|
|
217
|
+
patientSession PatientSession? @relation(fields: [patientSessionId], references: [id], onDelete: SetNull)
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
model SessionData {
|
|
215
|
-
id String
|
|
216
|
-
sessionExerciseId String
|
|
221
|
+
id String @id
|
|
222
|
+
sessionExerciseId String?
|
|
217
223
|
value String
|
|
218
|
-
sessionExercise SessionExercise @relation(fields: [sessionExerciseId], references: [id])
|
|
224
|
+
sessionExercise SessionExercise? @relation(fields: [sessionExerciseId], references: [id], onDelete: SetNull)
|
|
219
225
|
}
|
|
220
226
|
|
|
221
227
|
model Subscription {
|