@bslau/hmm_prisma_schema 1.4.0 → 1.5.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.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "CIPA Development Team",
|
|
6
6
|
"license": "ISC",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"prisma:create": "npx prisma migrate dev --create-only",
|
|
16
16
|
"prisma:deploy": "npx prisma migrate deploy",
|
|
17
17
|
"prisma:seed": "npx prisma db seed",
|
|
18
|
+
"prisma:format": "npx prisma format",
|
|
18
19
|
"prettier:check": "npx prettier --check prisma",
|
|
19
20
|
"prettier:write": "npx prettier --write prisma",
|
|
20
21
|
"test": "echo \"Error: no test specified\" && exit 1"
|
package/prisma/migrations/20250526012646_hotmetal_mass_hot_metal_tldl_estimated_float/migration.sql
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
BEGIN TRY
|
|
2
|
+
|
|
3
|
+
BEGIN TRAN;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE [dbo].[HotMetal] ALTER COLUMN [massHotMetalTldlEstimated] FLOAT(53) NULL;
|
|
7
|
+
|
|
8
|
+
COMMIT TRAN;
|
|
9
|
+
|
|
10
|
+
END TRY
|
|
11
|
+
BEGIN CATCH
|
|
12
|
+
|
|
13
|
+
IF @@TRANCOUNT > 0
|
|
14
|
+
BEGIN
|
|
15
|
+
ROLLBACK TRAN;
|
|
16
|
+
END;
|
|
17
|
+
THROW
|
|
18
|
+
|
|
19
|
+
END CATCH
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `displayModeId` on the `NotificationDisplayMode` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `notificationId` on the `NotificationDisplayMode` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the `displayMode` table. If the table is not empty, all the data it contains will be lost.
|
|
7
|
+
- A unique constraint covering the columns `[name]` on the table `NotificationDisplayMode` will be added. If there are existing duplicate values, this will fail.
|
|
8
|
+
- Added the required column `description` to the `NotificationDisplayMode` table without a default value. This is not possible if the table is not empty.
|
|
9
|
+
- Added the required column `label` to the `NotificationDisplayMode` table without a default value. This is not possible if the table is not empty.
|
|
10
|
+
- Added the required column `name` to the `NotificationDisplayMode` table without a default value. This is not possible if the table is not empty.
|
|
11
|
+
|
|
12
|
+
*/
|
|
13
|
+
BEGIN TRY
|
|
14
|
+
|
|
15
|
+
BEGIN TRAN;
|
|
16
|
+
|
|
17
|
+
-- DropForeignKey
|
|
18
|
+
ALTER TABLE [dbo].[NotificationDisplayMode] DROP CONSTRAINT [NotificationDisplayMode_displayModeId_fkey];
|
|
19
|
+
|
|
20
|
+
-- DropForeignKey
|
|
21
|
+
ALTER TABLE [dbo].[NotificationDisplayMode] DROP CONSTRAINT [NotificationDisplayMode_notificationId_fkey];
|
|
22
|
+
|
|
23
|
+
-- AlterTable
|
|
24
|
+
ALTER TABLE [dbo].[Notification] ALTER COLUMN [torpedoId] INT NULL;
|
|
25
|
+
|
|
26
|
+
-- AlterTable
|
|
27
|
+
ALTER TABLE [dbo].[NotificationDisplayMode] DROP COLUMN [displayModeId],
|
|
28
|
+
[notificationId];
|
|
29
|
+
ALTER TABLE [dbo].[NotificationDisplayMode] ADD [description] NVARCHAR(1000) NOT NULL,
|
|
30
|
+
[label] NVARCHAR(1000) NOT NULL,
|
|
31
|
+
[name] NVARCHAR(1000) NOT NULL;
|
|
32
|
+
|
|
33
|
+
-- DropTable
|
|
34
|
+
DROP TABLE [dbo].[displayMode];
|
|
35
|
+
|
|
36
|
+
-- CreateTable
|
|
37
|
+
CREATE TABLE [dbo].[NotificationDisplay] (
|
|
38
|
+
[id] INT NOT NULL IDENTITY(1,1),
|
|
39
|
+
[displayModeId] INT NOT NULL,
|
|
40
|
+
[notificationId] INT NOT NULL,
|
|
41
|
+
CONSTRAINT [NotificationDisplay_pkey] PRIMARY KEY CLUSTERED ([id])
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
-- CreateIndex
|
|
45
|
+
ALTER TABLE [dbo].[NotificationDisplayMode] ADD CONSTRAINT [NotificationDisplayMode_name_key] UNIQUE NONCLUSTERED ([name]);
|
|
46
|
+
|
|
47
|
+
-- AddForeignKey
|
|
48
|
+
ALTER TABLE [dbo].[NotificationDisplay] ADD CONSTRAINT [NotificationDisplay_displayModeId_fkey] FOREIGN KEY ([displayModeId]) REFERENCES [dbo].[NotificationDisplayMode]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
|
|
49
|
+
|
|
50
|
+
-- AddForeignKey
|
|
51
|
+
ALTER TABLE [dbo].[NotificationDisplay] ADD CONSTRAINT [NotificationDisplay_notificationId_fkey] FOREIGN KEY ([notificationId]) REFERENCES [dbo].[Notification]([id]) ON DELETE NO ACTION ON UPDATE CASCADE;
|
|
52
|
+
|
|
53
|
+
COMMIT TRAN;
|
|
54
|
+
|
|
55
|
+
END TRY
|
|
56
|
+
BEGIN CATCH
|
|
57
|
+
|
|
58
|
+
IF @@TRANCOUNT > 0
|
|
59
|
+
BEGIN
|
|
60
|
+
ROLLBACK TRAN;
|
|
61
|
+
END;
|
|
62
|
+
THROW
|
|
63
|
+
|
|
64
|
+
END CATCH
|
package/prisma/schema.prisma
CHANGED
|
@@ -192,7 +192,7 @@ model HotMetal {
|
|
|
192
192
|
dpLevelTldlManual Int?
|
|
193
193
|
capacity Int?
|
|
194
194
|
massHotMetalResidueTldl Int?
|
|
195
|
-
massHotMetalTldlEstimated
|
|
195
|
+
massHotMetalTldlEstimated Float?
|
|
196
196
|
massActual Int?
|
|
197
197
|
pot Pot? @relation(fields: [potId], references: [id])
|
|
198
198
|
potId Int?
|
|
@@ -470,17 +470,17 @@ model TorpedoTrip {
|
|
|
470
470
|
///
|
|
471
471
|
/// Data structure to handle all notifications for HMM
|
|
472
472
|
model Notification {
|
|
473
|
-
id
|
|
474
|
-
name
|
|
475
|
-
message
|
|
476
|
-
notificationCategories
|
|
477
|
-
|
|
478
|
-
notificationSource
|
|
479
|
-
notificationSourceId
|
|
480
|
-
torpedo
|
|
481
|
-
torpedoId
|
|
482
|
-
createdAt
|
|
483
|
-
updatedAt
|
|
473
|
+
id Int @id @default(autoincrement())
|
|
474
|
+
name String
|
|
475
|
+
message String
|
|
476
|
+
notificationCategories NotificationCategory[]
|
|
477
|
+
notificationDisplays NotificationDisplay[]
|
|
478
|
+
notificationSource NotificationSource @relation(fields: [notificationSourceId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
479
|
+
notificationSourceId Int
|
|
480
|
+
torpedo Torpedo? @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: Cascade)
|
|
481
|
+
torpedoId Int?
|
|
482
|
+
createdAt DateTime @default(now())
|
|
483
|
+
updatedAt DateTime @updatedAt
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
/// **HMM Notification Category**
|
|
@@ -497,11 +497,11 @@ model NotificationCategory {
|
|
|
497
497
|
/// ***HMM Display Modes for Notifications***
|
|
498
498
|
///
|
|
499
499
|
/// These display modes define how these notifications are displayed to the User
|
|
500
|
-
model
|
|
501
|
-
id Int
|
|
500
|
+
model NotificationDisplay {
|
|
501
|
+
id Int @id @default(autoincrement())
|
|
502
502
|
displayModeId Int
|
|
503
|
-
displayMode
|
|
504
|
-
notification Notification
|
|
503
|
+
displayMode NotificationDisplayMode @relation(fields: [displayModeId], references: [id])
|
|
504
|
+
notification Notification @relation(fields: [notificationId], references: [id], onDelete: NoAction, onUpdate: Cascade)
|
|
505
505
|
notificationId Int
|
|
506
506
|
// status Boolean @default(false) NOTES: Probably add something like this later to check for example if a notification has been acknowledged by the user
|
|
507
507
|
}
|
|
@@ -509,12 +509,12 @@ model NotificationDisplayMode {
|
|
|
509
509
|
/// ** HMM Display Mode Definitions **
|
|
510
510
|
///
|
|
511
511
|
/// These are the Defined Display Modes available to the HMM Application
|
|
512
|
-
model
|
|
513
|
-
id Int
|
|
514
|
-
name String
|
|
512
|
+
model NotificationDisplayMode {
|
|
513
|
+
id Int @id @default(autoincrement())
|
|
514
|
+
name String @unique
|
|
515
515
|
label String
|
|
516
516
|
description String
|
|
517
|
-
notificationDisplayModes
|
|
517
|
+
notificationDisplayModes NotificationDisplay[]
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
/// ** HMM Notification Source **
|
package/prisma/seed.ts
CHANGED
|
@@ -649,12 +649,12 @@ async function main() {
|
|
|
649
649
|
}
|
|
650
650
|
|
|
651
651
|
// SEED: NotificationDisplay
|
|
652
|
-
if ((await prisma.
|
|
652
|
+
if ((await prisma.notificationDisplayMode.count()) > 0) {
|
|
653
653
|
console.log("SEED: DisplayMode - skipped.");
|
|
654
654
|
} else {
|
|
655
655
|
console.log("SEED: DisplayMode - generating...");
|
|
656
656
|
|
|
657
|
-
const createDisplayMode = await prisma.
|
|
657
|
+
const createDisplayMode = await prisma.notificationDisplayMode.createMany({
|
|
658
658
|
data: [
|
|
659
659
|
{
|
|
660
660
|
name: "BELL",
|