@bslau/hmm_prisma_schema 1.12.0 → 1.13.0
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
package/prisma/migrations/20251008003319_411522_prisma_new_event_torpedo_on_gas_model/migration.sql
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- CreateTable
|
|
6
|
+
CREATE TABLE [dbo].[EventTorpedoOnGas] (
|
|
7
|
+
[id] INT NOT NULL IDENTITY(1,1),
|
|
8
|
+
[eventId] INT NOT NULL,
|
|
9
|
+
[torpedoId] INT NOT NULL,
|
|
10
|
+
[timerStart] DATETIMEOFFSET NOT NULL,
|
|
11
|
+
[timerEnd] DATETIMEOFFSET NOT NULL,
|
|
12
|
+
[createdAt] DATETIME2 NOT NULL CONSTRAINT [EventTorpedoOnGas_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
[updatedAt] DATETIME2 NOT NULL,
|
|
14
|
+
CONSTRAINT [EventTorpedoOnGas_pkey] PRIMARY KEY CLUSTERED ([id]),
|
|
15
|
+
CONSTRAINT [EventTorpedoOnGas_eventId_key] UNIQUE NONCLUSTERED ([eventId])
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
-- AddForeignKey
|
|
19
|
+
ALTER TABLE [dbo].[EventTorpedoOnGas] ADD CONSTRAINT [EventTorpedoOnGas_eventId_fkey] FOREIGN KEY ([eventId]) REFERENCES [dbo].[EventTracker]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
|
|
20
|
+
|
|
21
|
+
-- AddForeignKey
|
|
22
|
+
ALTER TABLE [dbo].[EventTorpedoOnGas] ADD CONSTRAINT [EventTorpedoOnGas_torpedoId_fkey] FOREIGN KEY ([torpedoId]) REFERENCES [dbo].[Torpedo]([torpedoId]) ON DELETE NO ACTION ON UPDATE CASCADE;
|
|
23
|
+
|
|
24
|
+
COMMIT TRAN;
|
|
25
|
+
|
|
26
|
+
END TRY
|
|
27
|
+
BEGIN CATCH
|
|
28
|
+
|
|
29
|
+
IF @@TRANCOUNT > 0
|
|
30
|
+
BEGIN
|
|
31
|
+
ROLLBACK TRAN;
|
|
32
|
+
END;
|
|
33
|
+
THROW
|
|
34
|
+
|
|
35
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -138,6 +138,22 @@ model EventTorpedoMaintenance {
|
|
|
138
138
|
updatedAt DateTime @updatedAt
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
/// **EVENT Torpedo On Gas**
|
|
142
|
+
///
|
|
143
|
+
/// Capture when a torpedo is on gas and off gas.
|
|
144
|
+
|
|
145
|
+
model EventTorpedoOnGas {
|
|
146
|
+
id Int @id @default(autoincrement())
|
|
147
|
+
event EventTracker @relation(fields: [eventId], references: [id])
|
|
148
|
+
eventId Int @unique
|
|
149
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId])
|
|
150
|
+
torpedoId Int
|
|
151
|
+
timerStart DateTime @db.DateTimeOffset
|
|
152
|
+
timerEnd DateTime @db.DateTimeOffset
|
|
153
|
+
createdAt DateTime @default(now())
|
|
154
|
+
updatedAt DateTime @updatedAt
|
|
155
|
+
}
|
|
156
|
+
|
|
141
157
|
/// **EVENT TRACKER**
|
|
142
158
|
///
|
|
143
159
|
/// Represents a generic system _Event_, which maps to its model instance.
|
|
@@ -150,6 +166,7 @@ model EventTracker {
|
|
|
150
166
|
torpedoMovement EventTorpedoMovement?
|
|
151
167
|
torpedoCapacity EventTorpedoCapacity?
|
|
152
168
|
torpedoMaintenance EventTorpedoMaintenance?
|
|
169
|
+
eventTorpedoOnGas EventTorpedoOnGas?
|
|
153
170
|
}
|
|
154
171
|
|
|
155
172
|
/// **HOT METAL HANDLER COMMENT**
|
|
@@ -383,6 +400,7 @@ model Torpedo {
|
|
|
383
400
|
eventsTorpedoMovement EventTorpedoMovement[]
|
|
384
401
|
eventTorpedoCapacity EventTorpedoCapacity[]
|
|
385
402
|
eventTorpedoMaintenance EventTorpedoMaintenance[]
|
|
403
|
+
eventsTorpedoOnGas EventTorpedoOnGas[]
|
|
386
404
|
torpedoCampaign TorpedoCampaign[]
|
|
387
405
|
torpedoCycle TorpedoCycle[]
|
|
388
406
|
torpedoTrips TorpedoTrip[]
|