@bslau/hmm_prisma_schema 1.9.1 → 1.10.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bslau/hmm_prisma_schema",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "main": "index.js",
5
5
  "author": "CIPA Development Team",
6
6
  "license": "ISC",
@@ -0,0 +1,36 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- CreateTable
6
+ CREATE TABLE [dbo].[EventPerformanceOHP] (
7
+ [id] INT NOT NULL IDENTITY(1,1),
8
+ [eventId] INT NOT NULL,
9
+ [messageUUID] NVARCHAR(50) NOT NULL,
10
+ [dailyRunRateActual] INT NOT NULL CONSTRAINT [EventPerformanceOHP_dailyRunRateActual_df] DEFAULT 0,
11
+ [dailyRunRateActualValidFlag] BIT NOT NULL CONSTRAINT [EventPerformanceOHP_dailyRunRateActualValidFlag_df] DEFAULT 0,
12
+ [torpedoFleetCapacityAvailable] INT NOT NULL CONSTRAINT [EventPerformanceOHP_torpedoFleetCapacityAvailable_df] DEFAULT 0,
13
+ [torpedoFleetMassCarried] INT NOT NULL CONSTRAINT [EventPerformanceOHP_torpedoFleetMassCarried_df] DEFAULT 0,
14
+ [torpedoDumpMassCarried] INT NOT NULL CONSTRAINT [EventPerformanceOHP_torpedoDumpMassCarried_df] DEFAULT 0,
15
+ [potMassTotal] INT NOT NULL CONSTRAINT [EventPerformanceOHP_potMassTotal_df] DEFAULT 0,
16
+ [createdAt] DATETIME2 NOT NULL CONSTRAINT [EventPerformanceOHP_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
17
+ [updatedAt] DATETIME2 NOT NULL,
18
+ CONSTRAINT [EventPerformanceOHP_pkey] PRIMARY KEY CLUSTERED ([id]),
19
+ CONSTRAINT [EventPerformanceOHP_eventId_key] UNIQUE NONCLUSTERED ([eventId])
20
+ );
21
+
22
+ -- AddForeignKey
23
+ ALTER TABLE [dbo].[EventPerformanceOHP] ADD CONSTRAINT [EventPerformanceOHP_eventId_fkey] FOREIGN KEY ([eventId]) REFERENCES [dbo].[EventTracker]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
24
+
25
+ COMMIT TRAN;
26
+
27
+ END TRY
28
+ BEGIN CATCH
29
+
30
+ IF @@TRANCOUNT > 0
31
+ BEGIN
32
+ ROLLBACK TRAN;
33
+ END;
34
+ THROW
35
+
36
+ END CATCH
@@ -0,0 +1,19 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE [dbo].[EventPerformanceOHP] ALTER COLUMN [messageUUID] NVARCHAR(1000) NOT NULL;
7
+
8
+ COMMIT TRAN;
9
+
10
+ END TRY
11
+ BEGIN CATCH
12
+
13
+ IF @@TRANCOUNT > 0
14
+ BEGIN
15
+ ROLLBACK TRAN;
16
+ END;
17
+ THROW
18
+
19
+ END CATCH
@@ -51,6 +51,29 @@ model Cast {
51
51
  updatedAt DateTime @updatedAt
52
52
  }
53
53
 
54
+ /// **PERFORMANCE CALCULATION (OHP) EVENT**
55
+ ///
56
+ /// Capture the UUID value used for the AMQP message and the computed
57
+ /// Performance metrics whenever triggered by fleet changes.
58
+ ///
59
+ /// NOTE: Daily Run Rate is a rolling 3-hour average of Blast Furnace
60
+ /// production quantified as tonnes per day. All other metrics are measured in
61
+ /// tonnes.
62
+ model EventPerformanceOHP {
63
+ id Int @id @default(autoincrement())
64
+ event EventTracker @relation(fields: [eventId], references: [id])
65
+ eventId Int @unique
66
+ messageUUID String
67
+ dailyRunRateActual Int @default(0)
68
+ dailyRunRateActualValidFlag Boolean @default(false)
69
+ torpedoFleetCapacityAvailable Int @default(0)
70
+ torpedoFleetMassCarried Int @default(0)
71
+ torpedoDumpMassCarried Int @default(0)
72
+ potMassTotal Int @default(0)
73
+ createdAt DateTime @default(now())
74
+ updatedAt DateTime @updatedAt
75
+ }
76
+
54
77
  /// **TORPEDO MOVEMENT EVENT**
55
78
  ///
56
79
  /// Capture the details of a _Torpedo Movement_ triggered by a **HMC Operator**.
@@ -123,6 +146,7 @@ model EventTracker {
123
146
  eventTime DateTime @db.DateTimeOffset
124
147
  eventType String
125
148
  userId String?
149
+ performanceOHP EventPerformanceOHP?
126
150
  torpedoMovement EventTorpedoMovement?
127
151
  torpedoCapacity EventTorpedoCapacity?
128
152
  torpedoMaintenance EventTorpedoMaintenance?