@bslau/hmm_prisma_schema 1.6.0 → 1.7.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bslau/hmm_prisma_schema",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "main": "index.js",
5
5
  "author": "CIPA Development Team",
6
6
  "license": "ISC",
@@ -0,0 +1,22 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE [dbo].[Cast] ADD [integrationStage] INT NOT NULL CONSTRAINT [Cast_integrationStage_df] DEFAULT 0;
7
+
8
+ -- AlterTable
9
+ ALTER TABLE [dbo].[HotMetal] ADD [integrationStage] INT NOT NULL CONSTRAINT [HotMetal_integrationStage_df] DEFAULT 0;
10
+
11
+ COMMIT TRAN;
12
+
13
+ END TRY
14
+ BEGIN CATCH
15
+
16
+ IF @@TRANCOUNT > 0
17
+ BEGIN
18
+ ROLLBACK TRAN;
19
+ END;
20
+ THROW
21
+
22
+ END CATCH
@@ -0,0 +1,65 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `campaignRebrickingId` on the `TorpedoTrip` table. All the data in the column will be lost.
5
+ - You are about to drop the column `campaignSurveyId` on the `TorpedoTrip` table. All the data in the column will be lost.
6
+ - You are about to drop the `CampaignRebricking` table. If the table is not empty, all the data it contains will be lost.
7
+ - You are about to drop the `CampaignSurvey` table. If the table is not empty, all the data it contains will be lost.
8
+ - Added the required column `torpedoCampaignId` to the `TorpedoTrip` table without a default value. This is not possible if the table is not empty.
9
+
10
+ */
11
+ BEGIN TRY
12
+
13
+ BEGIN TRAN;
14
+
15
+ -- DropForeignKey
16
+ ALTER TABLE [dbo].[CampaignRebricking] DROP CONSTRAINT [CampaignRebricking_torpedoId_fkey];
17
+
18
+ -- DropForeignKey
19
+ ALTER TABLE [dbo].[CampaignSurvey] DROP CONSTRAINT [CampaignSurvey_torpedoId_fkey];
20
+
21
+ -- DropForeignKey
22
+ ALTER TABLE [dbo].[TorpedoTrip] DROP CONSTRAINT [TorpedoTrip_campaignRebrickingId_fkey];
23
+
24
+ -- DropForeignKey
25
+ ALTER TABLE [dbo].[TorpedoTrip] DROP CONSTRAINT [TorpedoTrip_campaignSurveyId_fkey];
26
+
27
+ -- AlterTable
28
+ ALTER TABLE [dbo].[TorpedoTrip] DROP COLUMN [campaignRebrickingId],
29
+ [campaignSurveyId];
30
+ ALTER TABLE [dbo].[TorpedoTrip] ADD [torpedoCampaignId] INT NOT NULL;
31
+
32
+ -- DropTable
33
+ DROP TABLE [dbo].[CampaignRebricking];
34
+
35
+ -- DropTable
36
+ DROP TABLE [dbo].[CampaignSurvey];
37
+
38
+ -- CreateTable
39
+ CREATE TABLE [dbo].[TorpedoCampaign] (
40
+ [id] INT NOT NULL IDENTITY(1,1),
41
+ [torpedoId] INT NOT NULL,
42
+ [isRebricking] BIT NOT NULL CONSTRAINT [TorpedoCampaign_isRebricking_df] DEFAULT 0,
43
+ [startTime] DATETIMEOFFSET NOT NULL CONSTRAINT [TorpedoCampaign_startTime_df] DEFAULT CURRENT_TIMESTAMP,
44
+ [endTime] DATETIMEOFFSET,
45
+ CONSTRAINT [TorpedoCampaign_pkey] PRIMARY KEY CLUSTERED ([id])
46
+ );
47
+
48
+ -- AddForeignKey
49
+ ALTER TABLE [dbo].[TorpedoCampaign] ADD CONSTRAINT [TorpedoCampaign_torpedoId_fkey] FOREIGN KEY ([torpedoId]) REFERENCES [dbo].[Torpedo]([torpedoId]) ON DELETE NO ACTION ON UPDATE CASCADE;
50
+
51
+ -- AddForeignKey
52
+ ALTER TABLE [dbo].[TorpedoTrip] ADD CONSTRAINT [TorpedoTrip_torpedoCampaignId_fkey] FOREIGN KEY ([torpedoCampaignId]) REFERENCES [dbo].[TorpedoCampaign]([id]) ON DELETE NO ACTION ON UPDATE NO ACTION;
53
+
54
+ COMMIT TRAN;
55
+
56
+ END TRY
57
+ BEGIN CATCH
58
+
59
+ IF @@TRANCOUNT > 0
60
+ BEGIN
61
+ ROLLBACK TRAN;
62
+ END;
63
+ THROW
64
+
65
+ END CATCH
@@ -8,37 +8,6 @@ datasource db {
8
8
  shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
9
9
  }
10
10
 
11
- /// **REBRICKING CAMPAIGN**
12
- ///
13
- /// The entire lifespan of _Torpedo_ lining, from installation to removal.
14
- ///
15
- /// This indicates the entire refractory lining (or just working lining) is
16
- /// removed and the tonnes and trips on the lining are reset.
17
- model CampaignRebricking {
18
- id Int @id @default(autoincrement())
19
- torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
20
- torpedoId Int
21
- torpedoTrips TorpedoTrip[]
22
- startTime DateTime @default(now()) @db.DateTimeOffset
23
- endTime DateTime? @db.DateTimeOffset
24
- }
25
-
26
- /// **SURVEY CAMPAIGN**
27
- ///
28
- /// A period of continual operation between OOS inspections (~2 annually).
29
- ///
30
- /// From OOS to OOS, used for _Torpedo Ladle_ refractory inspections, based on
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.
33
- model CampaignSurvey {
34
- id Int @id @default(autoincrement())
35
- torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
36
- torpedoId Int
37
- torpedoTrips TorpedoTrip[]
38
- startTime DateTime @default(now()) @db.DateTimeOffset
39
- endTime DateTime? @db.DateTimeOffset
40
- }
41
-
42
11
  /// **CAST**
43
12
  ///
44
13
  /// A (parent) lot of molten iron produced by a **Blast Furnace**.
@@ -60,15 +29,9 @@ model Cast {
60
29
  codeOpeningTaphole String?
61
30
  minutesToOpen Int?
62
31
  codeConditionTapholeCh String?
63
- // [?]
64
- // codeTypeRun String?
65
- // [?]
66
32
  massIronBeforeSlag Int?
67
- // [?]
68
33
  durationIronBeforeSlag Int?
69
- // [?]
70
34
  massSlagBeforeIron Int?
71
- // [?]
72
35
  durationSlagBeforeIron Int?
73
36
  identityClayBox Int?
74
37
  codeTypeClay String?
@@ -78,16 +41,14 @@ model Cast {
78
41
  preGunUpTemp Float?
79
42
  gunupMaxTemp Float?
80
43
  gunOnHoleDuration Float?
81
- // [?] Y/N Or Boolean
82
44
  codeKish String?
83
45
  codeTypeGunUp Int?
84
- // [?] Y/N Or Boolean
85
46
  codeFceDry String?
86
- // [?] Y/N Or Boolean
87
47
  codeWindCheck String?
48
+ integrationStage Int @default(0)
49
+ hotMetalCollection HotMetal[]
88
50
  createdAt DateTime @default(now())
89
51
  updatedAt DateTime @updatedAt
90
- hotMetalCollection HotMetal[]
91
52
  }
92
53
 
93
54
  /// **TORPEDO MOVEMENT EVENT**
@@ -223,32 +184,9 @@ model HotMetal {
223
184
  desulphurisationComplete Boolean @default(false)
224
185
  containsPunchOut Boolean @default(false)
225
186
  alPucksAdded Boolean @default(false)
187
+ integrationStage Int @default(0)
226
188
  createdAt DateTime @default(now())
227
189
  updatedAt DateTime @updatedAt
228
- // name String?
229
- // description String?
230
- // // TODO: confirm default value
231
- // addAlPucks Boolean @default(false)
232
- // // [?] Necessary?
233
- // // castEndDateTime DateTime
234
- // // [?] One to Many or Many to Many
235
- // consumerBy Int?
236
- // desulphurized Boolean @default(false)
237
- // mass Float?
238
- // massUnitOfMeasure String?
239
- // punchOut Boolean?
240
- // runRate Float?
241
- // silicon Float?
242
- // status String?
243
- // sulphur Float?
244
- // // [?] Necessary?
245
- // // Taphole
246
- // temperature Float?
247
- // temperatureUnitOfMeasure String?
248
- // torpedoFillEnd DateTime? @db.DateTimeOffset
249
- // torpedoFillStart DateTime? @db.DateTimeOffset
250
- // torpedoFillLevel Int?
251
- // torpedoes Torpedo[]
252
190
 
253
191
  @@unique(name: "cast_torpedo_id", [castSequence, torpedoId])
254
192
  }
@@ -387,8 +325,7 @@ model Torpedo {
387
325
  eventsTorpedoMovement EventTorpedoMovement[]
388
326
  eventTorpedoCapacity EventTorpedoCapacity[]
389
327
  eventTorpedoMaintenance EventTorpedoMaintenance[]
390
- campaignsRebricking CampaignRebricking[]
391
- campaignsSurvey CampaignSurvey[]
328
+ torpedoCampaign TorpedoCampaign[]
392
329
  torpedoCycle TorpedoCycle[]
393
330
  torpedoTrips TorpedoTrip[]
394
331
  notifications Notification[]
@@ -398,6 +335,28 @@ model Torpedo {
398
335
  updatedAt DateTime @updatedAt
399
336
  }
400
337
 
338
+ /// **TORPEDO CAMPAIGN**
339
+ ///
340
+ /// A period of continual operation between OOS inspections (~2 annually).
341
+ ///
342
+ /// From OOS to OOS, used for _Torpedo Ladle_ refractory inspections, based on
343
+ /// number of tonnes carried, typically carried out once or twice a year (on
344
+ /// average). The total tonnes and _Trips_ on the lining are not reset.
345
+ ///
346
+ /// isRebricking flag - The entire lifespan of _Torpedo_ lining, from installation to removal.
347
+ /// It is updated at the Ladle Survey Form by HMH Operator.
348
+ /// This indicates the entire refractory lining (or just working lining) is
349
+ /// removed and the tonnes and trips on the lining are reset.
350
+ model TorpedoCampaign {
351
+ id Int @id @default(autoincrement())
352
+ torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
353
+ torpedoId Int
354
+ torpedoTrips TorpedoTrip[]
355
+ isRebricking Boolean @default(false)
356
+ startTime DateTime @default(now()) @db.DateTimeOffset
357
+ endTime DateTime? @db.DateTimeOffset
358
+ }
359
+
401
360
  /// **TORPEDO COMMENT**
402
361
  ///
403
362
  /// Stores comments for specific _Torpedoes_, logged by **HMC Operators**.
@@ -470,14 +429,12 @@ model TorpedoState {
470
429
  /// - End: _Torpedo Ladle_ fully emptied at **BOS Weighbridge** or **21 Dump**
471
430
  model TorpedoTrip {
472
431
  id Int @id @default(autoincrement())
473
- campaignRebricking CampaignRebricking @relation(fields: [campaignRebrickingId], references: [id], onDelete: NoAction, onUpdate: NoAction)
474
- campaignRebrickingId Int
475
- campaignSurvey CampaignSurvey @relation(fields: [campaignSurveyId], references: [id], onDelete: NoAction, onUpdate: NoAction)
476
- campaignSurveyId Int
477
432
  hotMetal HotMetal @relation(fields: [hotMetalId], references: [id], onDelete: NoAction, onUpdate: NoAction)
478
433
  hotMetalId Int
479
434
  torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: NoAction)
480
435
  torpedoId Int
436
+ torpedoCampaign TorpedoCampaign @relation(fields: [torpedoCampaignId], references: [id], onDelete: NoAction, onUpdate: NoAction)
437
+ torpedoCampaignId Int
481
438
  eventTorpedoCapacity EventTorpedoCapacity?
482
439
  eventsTorpedoMovement EventTorpedoMovement[]
483
440
  startTime DateTime @default(now()) @db.DateTimeOffset