@bslau/hmm_prisma_schema 1.1.19 → 1.1.20
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.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "CIPA Development Team",
|
|
6
6
|
"license": "ISC",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"postinstall": "npm run generate",
|
|
14
14
|
"prisma:apply": "npx prisma migrate dev",
|
|
15
15
|
"prisma:create": "npx prisma migrate dev --create-only",
|
|
16
|
+
"prisma:deploy": "npx prisma migrate deploy",
|
|
16
17
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
17
18
|
},
|
|
18
19
|
"types": "./index.d.ts",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE [dbo].[EventTorpedoMovement] ADD [torpedoCycleId] INT,
|
|
7
|
+
[torpedoStateId] INT NOT NULL CONSTRAINT [EventTorpedoMovement_torpedoStateId_df] DEFAULT 0,
|
|
8
|
+
[torpedoTripId] INT;
|
|
9
|
+
|
|
10
|
+
-- CreateTable
|
|
11
|
+
CREATE TABLE [dbo].[TorpedoCycle] (
|
|
12
|
+
[id] INT NOT NULL IDENTITY(1,1),
|
|
13
|
+
[hotMetalId] INT NOT NULL,
|
|
14
|
+
[torpedoId] INT NOT NULL,
|
|
15
|
+
[startTime] DATETIMEOFFSET NOT NULL CONSTRAINT [TorpedoCycle_startTime_df] DEFAULT CURRENT_TIMESTAMP,
|
|
16
|
+
[endTime] DATETIMEOFFSET,
|
|
17
|
+
CONSTRAINT [TorpedoCycle_pkey] PRIMARY KEY CLUSTERED ([id])
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE [dbo].[EventTorpedoMovement] ADD CONSTRAINT [EventTorpedoMovement_torpedoCycleId_fkey] FOREIGN KEY ([torpedoCycleId]) REFERENCES [dbo].[TorpedoCycle]([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
22
|
+
|
|
23
|
+
-- AddForeignKey
|
|
24
|
+
ALTER TABLE [dbo].[EventTorpedoMovement] ADD CONSTRAINT [EventTorpedoMovement_torpedoTripId_fkey] FOREIGN KEY ([torpedoTripId]) REFERENCES [dbo].[TorpedoTrip]([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
25
|
+
|
|
26
|
+
-- AddForeignKey
|
|
27
|
+
ALTER TABLE [dbo].[TorpedoCycle] ADD CONSTRAINT [TorpedoCycle_hotMetalId_fkey] FOREIGN KEY ([hotMetalId]) REFERENCES [dbo].[HotMetal]([id]) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
|
28
|
+
|
|
29
|
+
-- AddForeignKey
|
|
30
|
+
ALTER TABLE [dbo].[TorpedoCycle] ADD CONSTRAINT [TorpedoCycle_torpedoId_fkey] FOREIGN KEY ([torpedoId]) REFERENCES [dbo].[Torpedo]([torpedoId]) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
|
31
|
+
|
|
32
|
+
COMMIT TRAN;
|
|
33
|
+
|
|
34
|
+
END TRY
|
|
35
|
+
BEGIN CATCH
|
|
36
|
+
|
|
37
|
+
IF @@TRANCOUNT > 0
|
|
38
|
+
BEGIN
|
|
39
|
+
ROLLBACK TRAN;
|
|
40
|
+
END;
|
|
41
|
+
THROW
|
|
42
|
+
|
|
43
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -29,7 +29,7 @@ model CampaignRebricking {
|
|
|
29
29
|
///
|
|
30
30
|
/// From OOS to OOS, used for _Torpedo Ladle_ refractory inspections, based on
|
|
31
31
|
/// number of tonnes carried, typically carried out once or twice a year (on
|
|
32
|
-
/// average). The total tonnes and _Trips_ on the lining are not reset.
|
|
32
|
+
/// average). The total tonnes and _Trips_ on the lining are not reset.
|
|
33
33
|
model CampaignSurvey {
|
|
34
34
|
id Int @id @default(autoincrement())
|
|
35
35
|
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
|
|
@@ -93,24 +93,33 @@ model Cast {
|
|
|
93
93
|
/// **TORPEDO MOVEMENT EVENT**
|
|
94
94
|
///
|
|
95
95
|
/// Capture the details of a _Torpedo Movement_ triggered by a **HMC Operator**.
|
|
96
|
+
///
|
|
97
|
+
/// Each movement event captures the _Torpedo's_ operational _State_, and is
|
|
98
|
+
/// tracked within the context of the current _Trip_ and _Cycle_ - primarily for
|
|
99
|
+
/// reporting purposes.
|
|
96
100
|
model EventTorpedoMovement {
|
|
97
|
-
id Int
|
|
101
|
+
id Int @id @default(autoincrement())
|
|
98
102
|
torpedoId Int
|
|
99
|
-
torpedo Torpedo
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId])
|
|
104
|
+
torpedoStateId Int @default(0)
|
|
105
|
+
eventTime DateTime @db.DateTimeOffset
|
|
106
|
+
originStation Station @relation(name: "originStation-movement", fields: [originStationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
102
107
|
originStationId Int
|
|
103
|
-
originLocation Location
|
|
108
|
+
originLocation Location @relation(name: "originLocation-movement", fields: [originLocationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
104
109
|
originLocationId Int
|
|
105
|
-
destinationStation Station
|
|
110
|
+
destinationStation Station @relation(name: "destinationStation-movement", fields: [destinationStationId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
106
111
|
destinationStationId Int
|
|
107
|
-
destinationLocation Location
|
|
112
|
+
destinationLocation Location @relation(name: "destinationLocation-movement", fields: [destinationLocationId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
108
113
|
destinationLocationId Int
|
|
109
|
-
event EventTracker
|
|
110
|
-
eventId Int
|
|
114
|
+
event EventTracker @relation(fields: [eventId], references: [id])
|
|
115
|
+
eventId Int @unique
|
|
111
116
|
userId String?
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
torpedoCycle TorpedoCycle? @relation(fields: [torpedoCycleId], references: [id])
|
|
118
|
+
torpedoCycleId Int?
|
|
119
|
+
torpedoTrip TorpedoTrip? @relation(fields: [torpedoTripId], references: [id])
|
|
120
|
+
torpedoTripId Int?
|
|
121
|
+
createdAt DateTime @default(now())
|
|
122
|
+
updatedAt DateTime @updatedAt
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
/// **EVENT TRACKER**
|
|
@@ -141,7 +150,7 @@ model HMHComment {
|
|
|
141
150
|
///
|
|
142
151
|
/// A (child) sub-lot, or batch, of molten iron produced by a **Blast Furnace**.
|
|
143
152
|
///
|
|
144
|
-
///
|
|
153
|
+
/// Contains properties that describe when the _Hot Metal_ was produced and its
|
|
145
154
|
/// measured physical values.
|
|
146
155
|
model HotMetal {
|
|
147
156
|
id Int @id @default(autoincrement())
|
|
@@ -151,6 +160,7 @@ model HotMetal {
|
|
|
151
160
|
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
|
|
152
161
|
torpedoId Int
|
|
153
162
|
labResult HotMetalLabResult[]
|
|
163
|
+
torpedoCycle TorpedoCycle[]
|
|
154
164
|
torpedoTrip TorpedoTrip[]
|
|
155
165
|
dateTimeStartFill DateTime? @db.DateTimeOffset
|
|
156
166
|
dateTimeEndFill DateTime? @db.DateTimeOffset
|
|
@@ -209,7 +219,7 @@ model HotMetal {
|
|
|
209
219
|
|
|
210
220
|
/// **LAB RESULT**
|
|
211
221
|
///
|
|
212
|
-
/// _Hot
|
|
222
|
+
/// _Hot Metal_ testing data from the **LIMS** laboratory integration.
|
|
213
223
|
///
|
|
214
224
|
/// Describes the time, type, and chemical analysis properties for a batch of
|
|
215
225
|
/// _Hot Metal_. Samples are typically taken when filling at the **Blast Furnace**,
|
|
@@ -241,8 +251,8 @@ model HotMetalLabResult {
|
|
|
241
251
|
///
|
|
242
252
|
/// An operational location where _Torpedoes_ may be placed during use.
|
|
243
253
|
///
|
|
244
|
-
/// Within the context of HMM
|
|
245
|
-
///
|
|
254
|
+
/// Within the context of **HMM**, a _Location_ defines the physical place where a
|
|
255
|
+
/// _Torpedo_ is located, which is more precise than its _Station_.
|
|
246
256
|
model Location {
|
|
247
257
|
id Int @id @default(autoincrement())
|
|
248
258
|
name String
|
|
@@ -309,6 +319,7 @@ model Torpedo {
|
|
|
309
319
|
eventsTorpedoMovement EventTorpedoMovement[]
|
|
310
320
|
campaignsRebricking CampaignRebricking[]
|
|
311
321
|
campaignsSurvey CampaignSurvey[]
|
|
322
|
+
torpedoCycle TorpedoCycle[]
|
|
312
323
|
torpedoTrips TorpedoTrip[]
|
|
313
324
|
torpedoState TorpedoState? @relation(fields: [torpedoStateId], references: [id])
|
|
314
325
|
torpedoStateId Int?
|
|
@@ -329,6 +340,24 @@ model TorpedoComment {
|
|
|
329
340
|
updatedAt DateTime? @updatedAt
|
|
330
341
|
}
|
|
331
342
|
|
|
343
|
+
/// **TORPEDO CYCLE**
|
|
344
|
+
///
|
|
345
|
+
/// Used to capture each period between consecutive _Torpedo_ filling events.
|
|
346
|
+
///
|
|
347
|
+
/// Defined by:
|
|
348
|
+
/// - Start: **Blast Furnace** finish filling _Torpedo Ladle_
|
|
349
|
+
/// - End: Next **Blast Furnace** finish filling _Torpedo Ladle_
|
|
350
|
+
model TorpedoCycle {
|
|
351
|
+
id Int @id @default(autoincrement())
|
|
352
|
+
hotMetal HotMetal @relation(fields: [hotMetalId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
353
|
+
hotMetalId Int
|
|
354
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: NoAction)
|
|
355
|
+
torpedoId Int
|
|
356
|
+
eventsTorpedoMovement EventTorpedoMovement[]
|
|
357
|
+
startTime DateTime @default(now()) @db.DateTimeOffset
|
|
358
|
+
endTime DateTime? @db.DateTimeOffset
|
|
359
|
+
}
|
|
360
|
+
|
|
332
361
|
/// **TORPEDO LOCATION**
|
|
333
362
|
///
|
|
334
363
|
/// Defines the current operational _Location_ for each _Torpedo_.
|
|
@@ -365,18 +394,19 @@ model TorpedoState {
|
|
|
365
394
|
/// The period between finishing a fill, and consuming that _Hot Metal_.
|
|
366
395
|
///
|
|
367
396
|
/// Defined by:
|
|
368
|
-
/// - Start: **Blast Furnace** finish filling
|
|
397
|
+
/// - Start: **Blast Furnace** finish filling _Torpedo Ladle_
|
|
369
398
|
/// - End: _Torpedo Ladle_ fully emptied at **BOS Weighbridge** or **21 Dump**
|
|
370
399
|
model TorpedoTrip {
|
|
371
|
-
id
|
|
372
|
-
campaignRebricking
|
|
373
|
-
campaignRebrickingId
|
|
374
|
-
campaignSurvey
|
|
375
|
-
campaignSurveyId
|
|
376
|
-
hotMetal
|
|
377
|
-
hotMetalId
|
|
378
|
-
torpedo
|
|
379
|
-
torpedoId
|
|
380
|
-
|
|
381
|
-
|
|
400
|
+
id Int @id @default(autoincrement())
|
|
401
|
+
campaignRebricking CampaignRebricking @relation(fields: [campaignRebrickingId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
402
|
+
campaignRebrickingId Int
|
|
403
|
+
campaignSurvey CampaignSurvey @relation(fields: [campaignSurveyId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
404
|
+
campaignSurveyId Int
|
|
405
|
+
hotMetal HotMetal @relation(fields: [hotMetalId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
406
|
+
hotMetalId Int
|
|
407
|
+
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: NoAction)
|
|
408
|
+
torpedoId Int
|
|
409
|
+
eventsTorpedoMovement EventTorpedoMovement[]
|
|
410
|
+
startTime DateTime @default(now()) @db.DateTimeOffset
|
|
411
|
+
endTime DateTime? @db.DateTimeOffset
|
|
382
412
|
}
|