@bslau/hmm_prisma_schema 1.10.1 → 1.11.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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE [dbo].[HotMetal] ADD [hotMetalStateId] INT;
|
|
7
|
+
|
|
8
|
+
-- CreateTable
|
|
9
|
+
CREATE TABLE [dbo].[HotMetalState] (
|
|
10
|
+
[id] INT NOT NULL IDENTITY(1,1),
|
|
11
|
+
[name] NVARCHAR(1000) NOT NULL,
|
|
12
|
+
[label] NVARCHAR(1000) NOT NULL,
|
|
13
|
+
[description] NVARCHAR(1000) NOT NULL,
|
|
14
|
+
CONSTRAINT [HotMetalState_pkey] PRIMARY KEY CLUSTERED ([id]),
|
|
15
|
+
CONSTRAINT [HotMetalState_name_key] UNIQUE NONCLUSTERED ([name])
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
-- AddForeignKey
|
|
19
|
+
ALTER TABLE [dbo].[HotMetal] ADD CONSTRAINT [HotMetal_hotMetalStateId_fkey] FOREIGN KEY ([hotMetalStateId]) REFERENCES [dbo].[HotMetalState]([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
20
|
+
|
|
21
|
+
COMMIT TRAN;
|
|
22
|
+
|
|
23
|
+
END TRY
|
|
24
|
+
BEGIN CATCH
|
|
25
|
+
|
|
26
|
+
IF @@TRANCOUNT > 0
|
|
27
|
+
BEGIN
|
|
28
|
+
ROLLBACK TRAN;
|
|
29
|
+
END;
|
|
30
|
+
THROW
|
|
31
|
+
|
|
32
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -229,6 +229,8 @@ model HotMetal {
|
|
|
229
229
|
alPucksAdded Boolean @default(false)
|
|
230
230
|
integrationStage Int @default(0)
|
|
231
231
|
pourStatus Int @default(0)
|
|
232
|
+
hotMetalState HotMetalState? @relation(fields: [hotMetalStateId], references: [id])
|
|
233
|
+
hotMetalStateId Int?
|
|
232
234
|
createdAt DateTime @default(now())
|
|
233
235
|
updatedAt DateTime @updatedAt
|
|
234
236
|
|
|
@@ -265,6 +267,17 @@ model HotMetalLabResult {
|
|
|
265
267
|
updatedAt DateTime @updatedAt
|
|
266
268
|
}
|
|
267
269
|
|
|
270
|
+
/// **HOT METAL STATE**
|
|
271
|
+
///
|
|
272
|
+
/// Describes a valid operational _State_ that a _HotMetal_ batch can be assigned.
|
|
273
|
+
model HotMetalState {
|
|
274
|
+
id Int @id @default(autoincrement())
|
|
275
|
+
name String @unique
|
|
276
|
+
label String
|
|
277
|
+
description String
|
|
278
|
+
hotMetalCollection HotMetal[]
|
|
279
|
+
}
|
|
280
|
+
|
|
268
281
|
/// **LOCATION**
|
|
269
282
|
///
|
|
270
283
|
/// An operational location where _Torpedoes_ may be placed during use.
|
package/prisma/seed.ts
CHANGED
|
@@ -493,6 +493,8 @@ async function main() {
|
|
|
493
493
|
{ name: "POT", label: "Pot" },
|
|
494
494
|
{ name: "CONDITION", label: "Condition" },
|
|
495
495
|
{ name: "OVERRIDDEN", label: "Overridden" },
|
|
496
|
+
{ name: "TORPEDO_REJECTED", label: "Rejected" },
|
|
497
|
+
{ name: "TORPEDO_UPDATED", label: "Data Update" },
|
|
496
498
|
],
|
|
497
499
|
});
|
|
498
500
|
|
|
@@ -530,6 +532,11 @@ async function main() {
|
|
|
530
532
|
label: "Snackbar",
|
|
531
533
|
description: "Appears as snackbar, visible for 5 seconds.",
|
|
532
534
|
},
|
|
535
|
+
{
|
|
536
|
+
name: "POPUP_TORPEDO_REJECT",
|
|
537
|
+
label: "Popup Torpedo Reject",
|
|
538
|
+
description: "Appears as modal dialog, requires user acknowledgement.",
|
|
539
|
+
},
|
|
533
540
|
],
|
|
534
541
|
});
|
|
535
542
|
|
|
@@ -565,6 +572,24 @@ async function main() {
|
|
|
565
572
|
createNotificationSource,
|
|
566
573
|
});
|
|
567
574
|
}
|
|
575
|
+
|
|
576
|
+
// SEED: HotMetalState
|
|
577
|
+
if ((await prisma.hotMetalState.count()) > 0) {
|
|
578
|
+
console.log("SEED: HotMetalState - skipped.");
|
|
579
|
+
} else {
|
|
580
|
+
console.log("SEED: HotMetalState - generating...");
|
|
581
|
+
|
|
582
|
+
const createHotMetalState = await prisma.hotMetalState.createMany({
|
|
583
|
+
data: [
|
|
584
|
+
{ name: "BLEND", label: "Blended", description: "Composed of material from multiple sources" },
|
|
585
|
+
{ name: "REJECT", label: "Rejected", description: "Insufficient material for measurement" },
|
|
586
|
+
],
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
console.log({
|
|
590
|
+
createHotMetalState,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
568
593
|
}
|
|
569
594
|
|
|
570
595
|
main()
|