@bslau/hmm_prisma_schema 1.7.1 → 1.8.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.7.1",
3
+ "version": "1.8.0",
4
4
  "main": "index.js",
5
5
  "author": "CIPA Development Team",
6
6
  "license": "ISC",
@@ -0,0 +1,39 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- CreateTable
6
+ CREATE TABLE [dbo].[HMHLadleSurvey] (
7
+ [id] INT NOT NULL IDENTITY(1,1),
8
+ [torpedoId] INT NOT NULL,
9
+ [surveyDate] DATETIMEOFFSET,
10
+ [minThickness] INT,
11
+ [tonnesUntilSurveyDue] INT,
12
+ [comment] NVARCHAR(1000),
13
+ [resetOnLining] BIT NOT NULL CONSTRAINT [HMHLadleSurvey_resetOnLining_df] DEFAULT 0,
14
+ [activeCampaignId] INT,
15
+ [userId] NVARCHAR(1000),
16
+ [createdAt] DATETIME2 NOT NULL CONSTRAINT [HMHLadleSurvey_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
17
+ [updatedAt] DATETIME2,
18
+ CONSTRAINT [HMHLadleSurvey_pkey] PRIMARY KEY CLUSTERED ([id]),
19
+ CONSTRAINT [HMHLadleSurvey_activeCampaignId_key] UNIQUE NONCLUSTERED ([activeCampaignId])
20
+ );
21
+
22
+ -- AddForeignKey
23
+ ALTER TABLE [dbo].[HMHLadleSurvey] ADD CONSTRAINT [HMHLadleSurvey_torpedoId_fkey] FOREIGN KEY ([torpedoId]) REFERENCES [dbo].[Torpedo]([torpedoId]) ON DELETE NO ACTION ON UPDATE CASCADE;
24
+
25
+ -- AddForeignKey
26
+ ALTER TABLE [dbo].[HMHLadleSurvey] ADD CONSTRAINT [HMHLadleSurvey_activeCampaignId_fkey] FOREIGN KEY ([activeCampaignId]) REFERENCES [dbo].[TorpedoCampaign]([id]) ON DELETE NO ACTION ON UPDATE NO ACTION;
27
+
28
+ COMMIT TRAN;
29
+
30
+ END TRY
31
+ BEGIN CATCH
32
+
33
+ IF @@TRANCOUNT > 0
34
+ BEGIN
35
+ ROLLBACK TRAN;
36
+ END;
37
+ THROW
38
+
39
+ END CATCH
@@ -141,6 +141,25 @@ model HMHComment {
141
141
  updatedAt DateTime? @updatedAt
142
142
  }
143
143
 
144
+ /// **HOT METAL HANDLER LADLE SURVEY**
145
+ ///
146
+ /// Stores ladle survey form for specific _Torpedoes_, logged by **Maintenance Users**. (when torpedoes in OOS Station)
147
+ model HMHLadleSurvey {
148
+ id Int @id @default(autoincrement())
149
+ torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
150
+ torpedoId Int
151
+ surveyDate DateTime? @db.DateTimeOffset
152
+ minThickness Int?
153
+ tonnesUntilSurveyDue Int?
154
+ comment String?
155
+ resetOnLining Boolean @default(false)
156
+ activeCampaign TorpedoCampaign? @relation(fields: [activeCampaignId], references: [id], onDelete: NoAction, onUpdate: NoAction)
157
+ activeCampaignId Int? @unique
158
+ userId String?
159
+ createdAt DateTime @default(now())
160
+ updatedAt DateTime? @updatedAt
161
+ }
162
+
144
163
  /// **HOT METAL**
145
164
  ///
146
165
  /// A (child) sub-lot, or batch, of molten iron produced by a **Blast Furnace**.
@@ -322,6 +341,7 @@ model Torpedo {
322
341
  torpedoLocation TorpedoLocation?
323
342
  torpedoComments TorpedoComment[]
324
343
  hmhComments HMHComment[]
344
+ hmhLadleSurvey HMHLadleSurvey[]
325
345
  eventsTorpedoMovement EventTorpedoMovement[]
326
346
  eventTorpedoCapacity EventTorpedoCapacity[]
327
347
  eventTorpedoMaintenance EventTorpedoMaintenance[]
@@ -348,13 +368,14 @@ model Torpedo {
348
368
  /// This indicates the entire refractory lining (or just working lining) is
349
369
  /// removed and the tonnes and trips on the lining are reset.
350
370
  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
371
+ id Int @id @default(autoincrement())
372
+ torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
373
+ torpedoId Int
374
+ torpedoTrips TorpedoTrip[]
375
+ hmhLadleSurvey HMHLadleSurvey?
376
+ isRebricking Boolean @default(false)
377
+ startTime DateTime @default(now()) @db.DateTimeOffset
378
+ endTime DateTime? @db.DateTimeOffset
358
379
  }
359
380
 
360
381
  /// **TORPEDO COMMENT**