@virtality/schema 0.0.1-alpha.0.1 → 0.0.1-alpha.0.3
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,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- Added the required column `description` to the `Exercise` table without a default value. This is not possible if the table is not empty.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "Exercise" ADD COLUMN "description" TEXT NOT NULL,
|
|
9
|
+
ADD COLUMN "enabled" BOOLEAN NOT NULL DEFAULT false;
|
|
@@ -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 {
|
|
@@ -46,6 +46,8 @@ model Exercise {
|
|
|
46
46
|
bodyPart String
|
|
47
47
|
item String?
|
|
48
48
|
image String? @unique
|
|
49
|
+
description String
|
|
50
|
+
enabled Boolean @default(false)
|
|
49
51
|
programExercise ProgramExercise[]
|
|
50
52
|
sessionExercise SessionExercise[]
|
|
51
53
|
}
|
|
@@ -58,8 +60,8 @@ model Invitation {
|
|
|
58
60
|
status String
|
|
59
61
|
expiresAt DateTime @db.Timestamp(6)
|
|
60
62
|
inviterId String
|
|
61
|
-
user User @relation(fields: [inviterId], references: [id], onDelete:
|
|
62
|
-
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")
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
model Member {
|
|
@@ -68,8 +70,8 @@ model Member {
|
|
|
68
70
|
userId String
|
|
69
71
|
role String
|
|
70
72
|
createdAt DateTime @db.Timestamp(6)
|
|
71
|
-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade,
|
|
72
|
-
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")
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
model Organization {
|
|
@@ -81,25 +83,25 @@ model Organization {
|
|
|
81
83
|
metadata String?
|
|
82
84
|
isActive Boolean? @default(true)
|
|
83
85
|
isFrozen Boolean? @default(false)
|
|
84
|
-
members Member[]
|
|
85
86
|
invitations Invitation[]
|
|
87
|
+
members Member[]
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
model Patient {
|
|
89
|
-
id String @id(map: "patients_pkey")
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
email String?
|
|
93
|
-
phone String?
|
|
94
|
-
dob String?
|
|
95
|
-
sex String?
|
|
96
|
-
weight String?
|
|
97
|
-
height String?
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
id String @id(map: "patients_pkey")
|
|
92
|
+
name String
|
|
93
|
+
userId String?
|
|
94
|
+
email String?
|
|
95
|
+
phone String?
|
|
96
|
+
dob String?
|
|
97
|
+
sex String?
|
|
98
|
+
weight String?
|
|
99
|
+
height String?
|
|
100
|
+
history String?
|
|
101
|
+
image String? @unique
|
|
100
102
|
createdAt DateTime @default(now()) @db.Timestamp(6)
|
|
101
103
|
updatedAt DateTime @default(now()) @db.Timestamp(6)
|
|
102
|
-
|
|
104
|
+
deletedAt DateTime? @db.Timestamp(6)
|
|
103
105
|
patientProgram PatientProgram[]
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -108,10 +110,10 @@ model PatientProgram {
|
|
|
108
110
|
name String
|
|
109
111
|
userId String
|
|
110
112
|
patientId String
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
programExercise ProgramExercise[]
|
|
113
|
+
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
|
114
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
114
115
|
patientSession PatientSession[]
|
|
116
|
+
programExercise ProgramExercise[]
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
model ProgramExercise {
|
|
@@ -123,8 +125,8 @@ model ProgramExercise {
|
|
|
123
125
|
restTime Int @default(30)
|
|
124
126
|
holdTime Int @default(1)
|
|
125
127
|
speed Float @default(1)
|
|
126
|
-
patientProgram PatientProgram @relation(fields: [programId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "program_exercises_programId_fkey")
|
|
127
128
|
exercise Exercise @relation(fields: [exerciseId], references: [id])
|
|
129
|
+
patientProgram PatientProgram @relation(fields: [programId], references: [id], onDelete: Cascade, map: "program_exercises_programId_fkey")
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
model Session {
|
|
@@ -138,7 +140,7 @@ model Session {
|
|
|
138
140
|
userId String
|
|
139
141
|
activeOrganizationId String?
|
|
140
142
|
impersonatedBy String?
|
|
141
|
-
user User @relation(fields: [userId], references: [id], onDelete:
|
|
143
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "session_userId_fkey")
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
model User {
|
|
@@ -149,18 +151,19 @@ model User {
|
|
|
149
151
|
image String? @unique
|
|
150
152
|
createdAt DateTime @db.Timestamp(6)
|
|
151
153
|
updatedAt DateTime @db.Timestamp(6)
|
|
154
|
+
deletedAt DateTime? @db.Timestamp(6)
|
|
152
155
|
phone String?
|
|
153
156
|
stripeCustomerId String?
|
|
154
|
-
role String? @default("user")
|
|
155
|
-
banned Boolean?
|
|
156
|
-
banReason String?
|
|
157
157
|
banExpires DateTime?
|
|
158
|
+
banReason String?
|
|
159
|
+
banned Boolean?
|
|
160
|
+
role String? @default("user")
|
|
161
|
+
accounts Account[]
|
|
158
162
|
devices Device[]
|
|
163
|
+
invitations Invitation[]
|
|
164
|
+
members Member[]
|
|
159
165
|
patientProgram PatientProgram[]
|
|
160
166
|
sessions Session[]
|
|
161
|
-
accounts Account[]
|
|
162
|
-
members Member[]
|
|
163
|
-
invitations Invitation[]
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
model Verification {
|
|
@@ -173,10 +176,9 @@ model Verification {
|
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
model Avatar {
|
|
176
|
-
id
|
|
177
|
-
name
|
|
178
|
-
image
|
|
179
|
-
Patient Patient[]
|
|
179
|
+
id String @id
|
|
180
|
+
name String
|
|
181
|
+
image String? @unique
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
model Map {
|
|
@@ -187,33 +189,33 @@ model Map {
|
|
|
187
189
|
|
|
188
190
|
model PatientSession {
|
|
189
191
|
id String @id
|
|
190
|
-
programId String
|
|
192
|
+
programId String?
|
|
191
193
|
createdAt DateTime @db.Timestamp(6)
|
|
192
194
|
completedAt DateTime? @db.Timestamp(6)
|
|
193
195
|
deletedAt DateTime? @db.Timestamp(6)
|
|
194
|
-
program PatientProgram
|
|
196
|
+
program PatientProgram? @relation(fields: [programId], references: [id], onDelete: SetNull)
|
|
195
197
|
sessionExercise SessionExercise[]
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
model SessionExercise {
|
|
199
|
-
id String
|
|
200
|
-
patientSessionId String
|
|
201
|
+
id String @id
|
|
202
|
+
patientSessionId String?
|
|
201
203
|
exerciseId String
|
|
202
204
|
sets Int
|
|
203
205
|
reps Int
|
|
204
206
|
restTime Int
|
|
205
207
|
holdTime Int
|
|
206
208
|
speed Float
|
|
207
|
-
patientSession PatientSession @relation(fields: [patientSessionId], references: [id])
|
|
208
|
-
exercise Exercise @relation(fields: [exerciseId], references: [id])
|
|
209
209
|
sessionData SessionData[]
|
|
210
|
+
exercise Exercise @relation(fields: [exerciseId], references: [id])
|
|
211
|
+
patientSession PatientSession? @relation(fields: [patientSessionId], references: [id], onDelete: SetNull)
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
model SessionData {
|
|
213
|
-
id String
|
|
214
|
-
sessionExerciseId String
|
|
215
|
+
id String @id
|
|
216
|
+
sessionExerciseId String?
|
|
215
217
|
value String
|
|
216
|
-
sessionExercise SessionExercise @relation(fields: [sessionExerciseId], references: [id])
|
|
218
|
+
sessionExercise SessionExercise? @relation(fields: [sessionExerciseId], references: [id], onDelete: SetNull)
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
model Subscription {
|