@bslau/hmm_prisma_schema 1.14.0 → 1.15.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.14.0",
3
+ "version": "1.15.1",
4
4
  "main": "index.js",
5
5
  "author": "CIPA Development Team",
6
6
  "license": "ISC",
@@ -0,0 +1,75 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `potId` on the `HotMetal` table. All the data in the column will be lost.
5
+
6
+ */
7
+ BEGIN TRY
8
+
9
+ BEGIN TRAN;
10
+
11
+ -- DropForeignKey
12
+ ALTER TABLE [dbo].[HotMetal] DROP CONSTRAINT [HotMetal_potId_fkey];
13
+
14
+ -- AlterTable
15
+ ALTER TABLE [dbo].[HotMetal] DROP COLUMN [potId];
16
+
17
+ -- CreateTable
18
+ CREATE TABLE [dbo].[HotMetalPoured] (
19
+ [id] INT NOT NULL IDENTITY(1,1),
20
+ [isDumped] BIT NOT NULL CONSTRAINT [HotMetalPoured_isDumped_df] DEFAULT 0,
21
+ [mass] FLOAT(53) NOT NULL,
22
+ [hotMetalId] INT NOT NULL,
23
+ [potId] INT,
24
+ [createdAt] DATETIME2 NOT NULL CONSTRAINT [HotMetalPoured_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
25
+ [updatedAt] DATETIME2 NOT NULL,
26
+ CONSTRAINT [HotMetalPoured_pkey] PRIMARY KEY CLUSTERED ([id])
27
+ );
28
+
29
+ -- CreateTable
30
+ CREATE TABLE [dbo].[PotMetal] (
31
+ [id] INT NOT NULL IDENTITY(1,1),
32
+ [isConsumed] BIT NOT NULL CONSTRAINT [PotMetal_isConsumed_df] DEFAULT 0,
33
+ [dateConsumed] DATETIMEOFFSET NOT NULL,
34
+ [potId] INT NOT NULL,
35
+ [createdAt] DATETIME2 NOT NULL CONSTRAINT [PotMetal_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
36
+ [updatedAt] DATETIME2 NOT NULL,
37
+ CONSTRAINT [PotMetal_pkey] PRIMARY KEY CLUSTERED ([id])
38
+ );
39
+
40
+ -- CreateTable
41
+ CREATE TABLE [dbo].[PotMetalPoured] (
42
+ [id] INT NOT NULL IDENTITY(1,1),
43
+ [isReturnedSteel] BIT NOT NULL CONSTRAINT [PotMetalPoured_isReturnedSteel_df] DEFAULT 0,
44
+ [mass] FLOAT(53) NOT NULL,
45
+ [potMetalId] INT NOT NULL,
46
+ [createdAt] DATETIME2 NOT NULL CONSTRAINT [PotMetalPoured_createdAt_df] DEFAULT CURRENT_TIMESTAMP,
47
+ [updatedAt] DATETIME2 NOT NULL,
48
+ CONSTRAINT [PotMetalPoured_pkey] PRIMARY KEY CLUSTERED ([id]),
49
+ CONSTRAINT [PotMetalPoured_potMetalId_key] UNIQUE NONCLUSTERED ([potMetalId])
50
+ );
51
+
52
+ -- AddForeignKey
53
+ ALTER TABLE [dbo].[HotMetalPoured] ADD CONSTRAINT [HotMetalPoured_hotMetalId_fkey] FOREIGN KEY ([hotMetalId]) REFERENCES [dbo].[HotMetal]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
54
+
55
+ -- AddForeignKey
56
+ ALTER TABLE [dbo].[HotMetalPoured] ADD CONSTRAINT [HotMetalPoured_potId_fkey] FOREIGN KEY ([potId]) REFERENCES [dbo].[Pot]([id]) ON DELETE SET NULL ON UPDATE CASCADE;
57
+
58
+ -- AddForeignKey
59
+ ALTER TABLE [dbo].[PotMetal] ADD CONSTRAINT [PotMetal_potId_fkey] FOREIGN KEY ([potId]) REFERENCES [dbo].[Pot]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
60
+
61
+ -- AddForeignKey
62
+ ALTER TABLE [dbo].[PotMetalPoured] ADD CONSTRAINT [PotMetalPoured_potMetalId_fkey] FOREIGN KEY ([potMetalId]) REFERENCES [dbo].[PotMetal]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
63
+
64
+ COMMIT TRAN;
65
+
66
+ END TRY
67
+ BEGIN CATCH
68
+
69
+ IF @@TRANCOUNT > 0
70
+ BEGIN
71
+ ROLLBACK TRAN;
72
+ END;
73
+ THROW
74
+
75
+ END CATCH
@@ -255,8 +255,6 @@ model HotMetal {
255
255
  massHotMetalResidueTldl Int?
256
256
  massHotMetalTldlEstimated Float?
257
257
  massActual Int?
258
- pot Pot? @relation(fields: [potId], references: [id])
259
- potId Int?
260
258
  runRate Float?
261
259
  punchOut Boolean @default(false)
262
260
  plannedLevelFill Int?
@@ -272,6 +270,7 @@ model HotMetal {
272
270
  pourStatus Int @default(0)
273
271
  hotMetalState HotMetalState? @relation(fields: [hotMetalStateId], references: [id])
274
272
  hotMetalStateId Int?
273
+ hotMetalPouredCollection HotMetalPoured[]
275
274
  createdAt DateTime @default(now())
276
275
  updatedAt DateTime @updatedAt
277
276
 
@@ -308,6 +307,22 @@ model HotMetalLabResult {
308
307
  updatedAt DateTime @updatedAt
309
308
  }
310
309
 
310
+ /// **HOT METAL POURED**
311
+ ///
312
+ /// Provides information about when a _Hot Metal_ batch is poured, which _Pot_ it is poured into,
313
+ /// and the mass of material that has been poured.
314
+ model HotMetalPoured {
315
+ id Int @id @default(autoincrement())
316
+ isDumped Boolean @default(false)
317
+ mass Float
318
+ hotMetalId Int
319
+ hotMetal HotMetal @relation(references: [id], fields: [hotMetalId])
320
+ potId Int?
321
+ pot Pot? @relation(references: [id], fields: [potId])
322
+ createdAt DateTime @default(now())
323
+ updatedAt DateTime @updatedAt
324
+ }
325
+
311
326
  /// **HOT METAL STATE**
312
327
  ///
313
328
  /// Describes a valid operational _State_ that a _HotMetal_ batch can be assigned.
@@ -362,9 +377,37 @@ model OperationalState {
362
377
  ///
363
378
  /// Normal operations will "empty" a Torpedo's Hot Metal into a specific Pot.
364
379
  model Pot {
365
- id Int @id @default(autoincrement())
366
- name String @unique
367
- HotMetal HotMetal[]
380
+ id Int @id @default(autoincrement())
381
+ name String @unique
382
+ hotMetalPouredCollection HotMetalPoured[]
383
+ potMetalCollection PotMetal[]
384
+ }
385
+
386
+ /// **POT METAL**
387
+ ///
388
+ /// Represents the _Hot Metal_ poured into a pot, and tracks when the pot is emptied
389
+ model PotMetal {
390
+ id Int @id @default(autoincrement())
391
+ isConsumed Boolean @default(false)
392
+ dateConsumed DateTime @db.DateTimeOffset
393
+ potMetalPouredCollection PotMetalPoured[]
394
+ potId Int
395
+ pot Pot @relation(references: [id], fields: [potId])
396
+ createdAt DateTime @default(now())
397
+ updatedAt DateTime @updatedAt
398
+ }
399
+
400
+ /// **POT METAL POURED**
401
+ ///
402
+ /// Provides information about the pot when it is poured.
403
+ model PotMetalPoured {
404
+ id Int @id @default(autoincrement())
405
+ isReturnedSteel Boolean @default(false)
406
+ mass Float
407
+ potMetalId Int @unique
408
+ potMetal PotMetal @relation(references: [id], fields: [potMetalId])
409
+ createdAt DateTime @default(now())
410
+ updatedAt DateTime @updatedAt
368
411
  }
369
412
 
370
413
  /// **STATION**