@bslau/hmm_prisma_schema 1.6.1 → 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
|
@@ -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
|
package/prisma/schema.prisma
CHANGED
|
@@ -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**.
|
|
@@ -356,8 +325,7 @@ model Torpedo {
|
|
|
356
325
|
eventsTorpedoMovement EventTorpedoMovement[]
|
|
357
326
|
eventTorpedoCapacity EventTorpedoCapacity[]
|
|
358
327
|
eventTorpedoMaintenance EventTorpedoMaintenance[]
|
|
359
|
-
|
|
360
|
-
campaignsSurvey CampaignSurvey[]
|
|
328
|
+
torpedoCampaign TorpedoCampaign[]
|
|
361
329
|
torpedoCycle TorpedoCycle[]
|
|
362
330
|
torpedoTrips TorpedoTrip[]
|
|
363
331
|
notifications Notification[]
|
|
@@ -367,6 +335,28 @@ model Torpedo {
|
|
|
367
335
|
updatedAt DateTime @updatedAt
|
|
368
336
|
}
|
|
369
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
|
+
|
|
370
360
|
/// **TORPEDO COMMENT**
|
|
371
361
|
///
|
|
372
362
|
/// Stores comments for specific _Torpedoes_, logged by **HMC Operators**.
|
|
@@ -439,14 +429,12 @@ model TorpedoState {
|
|
|
439
429
|
/// - End: _Torpedo Ladle_ fully emptied at **BOS Weighbridge** or **21 Dump**
|
|
440
430
|
model TorpedoTrip {
|
|
441
431
|
id Int @id @default(autoincrement())
|
|
442
|
-
campaignRebricking CampaignRebricking @relation(fields: [campaignRebrickingId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
443
|
-
campaignRebrickingId Int
|
|
444
|
-
campaignSurvey CampaignSurvey @relation(fields: [campaignSurveyId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
445
|
-
campaignSurveyId Int
|
|
446
432
|
hotMetal HotMetal @relation(fields: [hotMetalId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
447
433
|
hotMetalId Int
|
|
448
434
|
torpedo Torpedo @relation(fields: [torpedoId], references: [torpedoId], onDelete: NoAction, onUpdate: NoAction)
|
|
449
435
|
torpedoId Int
|
|
436
|
+
torpedoCampaign TorpedoCampaign @relation(fields: [torpedoCampaignId], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
|
437
|
+
torpedoCampaignId Int
|
|
450
438
|
eventTorpedoCapacity EventTorpedoCapacity?
|
|
451
439
|
eventsTorpedoMovement EventTorpedoMovement[]
|
|
452
440
|
startTime DateTime @default(now()) @db.DateTimeOffset
|