@bslau/hmm_prisma_schema 1.1.21 → 1.1.23

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/README.md CHANGED
@@ -11,8 +11,19 @@ TODO: Guide users through getting your code up and running on their own system.
11
11
  # Build and Test
12
12
  TODO: Describe and show how to build your code and run the tests.
13
13
 
14
- # Contribute
15
- TODO: Explain how other users and developers can contribute to make your code better.
14
+ # Edit prisma schema
15
+ TODO: Explain how other users and developers can edit prisma schema.
16
+ >create a branch
17
+
18
+ >edit schema.prisma
19
+
20
+ >npx prisma format
21
+
22
+ >npx prisma migrate dev --name new schema
23
+
24
+ >update version in package.json
25
+
26
+ >raise PR for merging to main branch
16
27
 
17
28
  If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:
18
29
  - [ASP.NET Core](https://github.com/aspnet/Home)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bslau/hmm_prisma_schema",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "main": "index.js",
5
5
  "author": "CIPA Development Team",
6
6
  "license": "ISC",
@@ -0,0 +1,19 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE [dbo].[HotMetal] ADD [potNumber] INT;
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,37 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `potNumber` on the `HotMetal` table. All the data in the column will be lost.
5
+
6
+ */
7
+ BEGIN TRY
8
+
9
+ BEGIN TRAN;
10
+
11
+ -- AlterTable
12
+ ALTER TABLE [dbo].[HotMetal] DROP COLUMN [potNumber];
13
+ ALTER TABLE [dbo].[HotMetal] ADD [potId] INT;
14
+
15
+ -- CreateTable
16
+ CREATE TABLE [dbo].[Pot] (
17
+ [id] INT NOT NULL IDENTITY(1,1),
18
+ [name] NVARCHAR(1000) NOT NULL,
19
+ CONSTRAINT [Pot_pkey] PRIMARY KEY CLUSTERED ([id]),
20
+ CONSTRAINT [Pot_name_key] UNIQUE NONCLUSTERED ([name])
21
+ );
22
+
23
+ -- AddForeignKey
24
+ ALTER TABLE [dbo].[HotMetal] ADD CONSTRAINT [HotMetal_potId_fkey] FOREIGN KEY ([potId]) REFERENCES [dbo].[Pot]([id]) ON DELETE SET NULL ON UPDATE CASCADE;
25
+
26
+ COMMIT TRAN;
27
+
28
+ END TRY
29
+ BEGIN CATCH
30
+
31
+ IF @@TRANCOUNT > 0
32
+ BEGIN
33
+ ROLLBACK TRAN;
34
+ END;
35
+ THROW
36
+
37
+ END CATCH
@@ -0,0 +1,20 @@
1
+ BEGIN TRY
2
+
3
+ BEGIN TRAN;
4
+
5
+ -- AlterTable
6
+ ALTER TABLE [dbo].[Torpedo] ADD [capacityDynamic] FLOAT(53),
7
+ [capacityNominal] FLOAT(53) NOT NULL CONSTRAINT [Torpedo_capacityNominal_df] DEFAULT 200;
8
+
9
+ COMMIT TRAN;
10
+
11
+ END TRY
12
+ BEGIN CATCH
13
+
14
+ IF @@TRANCOUNT > 0
15
+ BEGIN
16
+ ROLLBACK TRAN;
17
+ END;
18
+ THROW
19
+
20
+ END CATCH
@@ -0,0 +1,26 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `capacityDynamic` on the `Torpedo` table. All the data in the column will be lost.
5
+
6
+ */
7
+ BEGIN TRY
8
+
9
+ BEGIN TRAN;
10
+
11
+ -- AlterTable
12
+ ALTER TABLE [dbo].[Torpedo] DROP COLUMN [capacityDynamic];
13
+ ALTER TABLE [dbo].[Torpedo] ADD [capacityAverage] FLOAT(53);
14
+
15
+ COMMIT TRAN;
16
+
17
+ END TRY
18
+ BEGIN CATCH
19
+
20
+ IF @@TRANCOUNT > 0
21
+ BEGIN
22
+ ROLLBACK TRAN;
23
+ END;
24
+ THROW
25
+
26
+ END CATCH
@@ -192,6 +192,8 @@ model HotMetal {
192
192
  massHotMetalResidueTldl Int?
193
193
  massHotMetalTldlEstimated Int?
194
194
  massActual Int?
195
+ pot Pot? @relation(fields: [potId], references: [id])
196
+ potId Int?
195
197
  runRate Float?
196
198
  punchOut Boolean @default(false)
197
199
  plannedLevelFill Int?
@@ -323,8 +325,8 @@ model Torpedo {
323
325
  sixPitRestrictionEndTime DateTime? @db.DateTimeOffset
324
326
  status Int @default(2)
325
327
  // sixPitStart DateTime?
326
- // capacityDynamic Float?
327
- // capacityNominal Float?
328
+ capacityAverage Float?
329
+ capacityNominal Float @default(200)
328
330
  // comments String?
329
331
  // emptyWeight Float?
330
332
  // gasStart DateTime?
@@ -427,3 +429,12 @@ model TorpedoTrip {
427
429
  startTime DateTime @default(now()) @db.DateTimeOffset
428
430
  endTime DateTime? @db.DateTimeOffset
429
431
  }
432
+
433
+ /// **POT**
434
+ ///
435
+ /// Pot Number is a property in Hot Metal Model.
436
+ model Pot {
437
+ id Int @id @default(autoincrement())
438
+ name String @unique
439
+ HotMetal HotMetal[]
440
+ }
package/prisma/seed.ts CHANGED
@@ -562,6 +562,29 @@ async function main() {
562
562
  createTorpedoState,
563
563
  });
564
564
  }
565
+
566
+ // SEED: Pot
567
+ if (await prisma.pot.count() > 0) {
568
+ console.log("SEED: Pot - skipped.");
569
+ } else {
570
+ console.log("SEED: Pot - generating...");
571
+
572
+ const createPot = await prisma.pot.createMany({
573
+ data: [
574
+ { name: "Pot 1"},
575
+ { name: "Pot 2"},
576
+ { name: "Pot 3"},
577
+ { name: "Pot 4"},
578
+ { name: "Pot 5"},
579
+ { name: "Pot 6"},
580
+ { name: "Pot 7"},
581
+ ],
582
+ });
583
+
584
+ console.log({
585
+ createPot,
586
+ });
587
+ }
565
588
  }
566
589
 
567
590
  main()