@bslau/hmm_prisma_schema 1.5.3 → 1.5.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,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- A unique constraint covering the columns `[eventId]` on the table `EventTorpedoMaintenance` will be added. If there are existing duplicate values, this will fail.
|
|
5
|
+
- Added the required column `eventId` to the `EventTorpedoMaintenance` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
BEGIN TRY
|
|
9
|
+
|
|
10
|
+
BEGIN TRAN;
|
|
11
|
+
|
|
12
|
+
-- AlterTable
|
|
13
|
+
ALTER TABLE [dbo].[EventTorpedoMaintenance] ADD [eventId] INT NOT NULL;
|
|
14
|
+
|
|
15
|
+
-- CreateIndex
|
|
16
|
+
ALTER TABLE [dbo].[EventTorpedoMaintenance] ADD CONSTRAINT [EventTorpedoMaintenance_eventId_key] UNIQUE NONCLUSTERED ([eventId]);
|
|
17
|
+
|
|
18
|
+
-- AddForeignKey
|
|
19
|
+
ALTER TABLE [dbo].[EventTorpedoMaintenance] ADD CONSTRAINT [EventTorpedoMaintenance_eventId_fkey] FOREIGN KEY ([eventId]) REFERENCES [dbo].[EventTracker]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
|
|
20
|
+
|
|
21
|
+
COMMIT TRAN;
|
|
22
|
+
|
|
23
|
+
END TRY
|
|
24
|
+
BEGIN CATCH
|
|
25
|
+
|
|
26
|
+
IF @@TRANCOUNT > 0
|
|
27
|
+
BEGIN
|
|
28
|
+
ROLLBACK TRAN;
|
|
29
|
+
END;
|
|
30
|
+
THROW
|
|
31
|
+
|
|
32
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -144,24 +144,27 @@ model EventTorpedoCapacity {
|
|
|
144
144
|
///
|
|
145
145
|
/// Capture when a Torpedo undergoes maintenance. (when a Torpedo is moved to the R+M Break Station for Maintenance.)
|
|
146
146
|
model EventTorpedoMaintenance {
|
|
147
|
-
id Int
|
|
148
|
-
|
|
147
|
+
id Int @id @default(autoincrement())
|
|
148
|
+
event EventTracker @relation(fields: [eventId], references: [id])
|
|
149
|
+
eventId Int @unique
|
|
150
|
+
maintenanceDate DateTime @db.DateTimeOffset
|
|
149
151
|
torpedoId Int
|
|
150
|
-
torpedo Torpedo
|
|
151
|
-
createdAt DateTime
|
|
152
|
-
updatedAt DateTime
|
|
152
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId])
|
|
153
|
+
createdAt DateTime @default(now())
|
|
154
|
+
updatedAt DateTime @updatedAt
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
/// **EVENT TRACKER**
|
|
156
158
|
///
|
|
157
159
|
/// Represents a generic system _Event_, which maps to its model instance.
|
|
158
160
|
model EventTracker {
|
|
159
|
-
id
|
|
160
|
-
eventTime
|
|
161
|
-
eventType
|
|
162
|
-
userId
|
|
163
|
-
torpedoMovement
|
|
164
|
-
torpedoCapacity
|
|
161
|
+
id Int @id @default(autoincrement())
|
|
162
|
+
eventTime DateTime @db.DateTimeOffset
|
|
163
|
+
eventType String
|
|
164
|
+
userId String?
|
|
165
|
+
torpedoMovement EventTorpedoMovement?
|
|
166
|
+
torpedoCapacity EventTorpedoCapacity?
|
|
167
|
+
torpedoMaintenance EventTorpedoMaintenance?
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
/// **HOT METAL HANDLER COMMENT**
|