@bslau/hmm_prisma_schema 1.1.23 → 1.3.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/README.md +35 -22
- package/package.json +2 -1
- package/prisma/schema.prisma +32 -11
package/README.md
CHANGED
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
#
|
|
2
|
-
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
|
|
1
|
+
# Editing Prisma Schema
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
|
|
6
|
-
1. Installation process
|
|
7
|
-
2. Software dependencies
|
|
8
|
-
3. Latest releases
|
|
9
|
-
4. API references
|
|
3
|
+
The general workflow will follow these steps:
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
- Create and checkout a new working branch.
|
|
6
|
+
- Edit `schema.prisma` as needed.
|
|
7
|
+
- Run automated formatting: `npx prisma format`
|
|
8
|
+
- Prepare database changes (as needed):
|
|
9
|
+
- create (preview) migration: `npm prisma:create` or;
|
|
10
|
+
- create and apply migration: `npm prisma:apply`
|
|
11
|
+
- Update *minor* version number in `package.json`
|
|
12
|
+
`"version": "[MAJOR].[MINOR].[PATCH]"`
|
|
13
|
+
- Create and test new seeding function(s) if required - being cautious to avoid creating **duplicate** records on repeated runs.
|
|
14
|
+
- Raise PR for merging back into main branch.
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
TODO: Explain how other users and developers can edit prisma schema.
|
|
16
|
-
>create a branch
|
|
16
|
+
The changes should be ready for review, merging, and publishing now.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
# Deploying Prisma Schema
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Completing the PR (merging into main) will automatically trigger the build and release pipelines that will publish the new version of the package to the remote npm repository.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
The latest version can then be installed in the application implementing the schema:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
`npm install @bslau/hmm_prisma_schema`
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
*NOTE* that doing this on the BlueScope network will typically **fail**. Installing this package involves generating a fresh Prisma client file - this is the part that seems to stall/fail because it's ignorant of the system proxy settings. The workaround is to use a hotspot internet connection without any proxy settings instead.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
# Manual Deployment for Test Environment
|
|
29
|
+
|
|
30
|
+
Current implementations of this package **don't** automate migration and seeding steps after release to the Test environment. This will result in schema mismatch between the Prisma package and the Test database when updates are released.
|
|
31
|
+
|
|
32
|
+
The workaround is to manually execute these steps after release. This example describes the process for the *GraphQL Apollo* server, but would also work for the *Event Processing* service (albeit in a different directory):
|
|
33
|
+
|
|
34
|
+
- RDP into the host server: `ITAVWEB91`
|
|
35
|
+
|
|
36
|
+
- Open a bash terminal and navigate to the installed package:
|
|
37
|
+
|
|
38
|
+
`cd /c/inetpub/wwwroot/hmm/graphql_server/node_modules/@bslau/hmm_prisma_schema`
|
|
39
|
+
|
|
40
|
+
- Apply any pending migrations: `npm run prisma:deploy`
|
|
41
|
+
|
|
42
|
+
- Run the seed function to create data: `npm run prisma:seed`
|
|
43
|
+
|
|
44
|
+
At this point, assuming no errors in deploying or seeding, the Test database schema should be synchronised with Prisma now.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bslau/hmm_prisma_schema",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "CIPA Development Team",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"prisma:apply": "npx prisma migrate dev",
|
|
15
15
|
"prisma:create": "npx prisma migrate dev --create-only",
|
|
16
16
|
"prisma:deploy": "npx prisma migrate deploy",
|
|
17
|
+
"prisma:seed": "npx prisma db seed",
|
|
17
18
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
19
|
},
|
|
19
20
|
"types": "./index.d.ts",
|
package/prisma/schema.prisma
CHANGED
|
@@ -283,6 +283,36 @@ model Location {
|
|
|
283
283
|
torpedoLocations TorpedoLocation[]
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
/// **OPERATIONAL STATE**
|
|
287
|
+
///
|
|
288
|
+
/// A reference object that contains data about the Operational State of HMM.
|
|
289
|
+
///
|
|
290
|
+
/// As certain Fleet/Operational Calculations are performed, the results will be
|
|
291
|
+
/// stored in the database, so that those values can be read/displayed without
|
|
292
|
+
/// having to always re-run the calculations.
|
|
293
|
+
model OperationalState {
|
|
294
|
+
id Int @id @default(autoincrement())
|
|
295
|
+
hotMetalPotTonnes Float @default(0)
|
|
296
|
+
hotMetalTorpedoTonnes Float @default(0)
|
|
297
|
+
hotMetalTotalTonnes Float @default(0)
|
|
298
|
+
torpedoesActiveTally Int @default(0)
|
|
299
|
+
torpedoesAvailableTally Int @default(0)
|
|
300
|
+
torpedoesCarryingTally Int @default(0)
|
|
301
|
+
torpedoesStandbyTally Int @default(0)
|
|
302
|
+
updatedAt DateTime @updatedAt
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/// **POT**
|
|
306
|
+
///
|
|
307
|
+
/// Physical equipment at the BOS for the transfer of Hot Metal from Torpedoes.
|
|
308
|
+
///
|
|
309
|
+
/// Normal operations will "empty" a Torpedo's Hot Metal into a specific Pot.
|
|
310
|
+
model Pot {
|
|
311
|
+
id Int @id @default(autoincrement())
|
|
312
|
+
name String @unique
|
|
313
|
+
HotMetal HotMetal[]
|
|
314
|
+
}
|
|
315
|
+
|
|
286
316
|
/// **STATION**
|
|
287
317
|
///
|
|
288
318
|
/// A logical location where different _Torpedo_ operations may occur.
|
|
@@ -325,8 +355,8 @@ model Torpedo {
|
|
|
325
355
|
sixPitRestrictionEndTime DateTime? @db.DateTimeOffset
|
|
326
356
|
status Int @default(2)
|
|
327
357
|
// sixPitStart DateTime?
|
|
328
|
-
capacityAverage
|
|
329
|
-
capacityNominal
|
|
358
|
+
capacityAverage Float?
|
|
359
|
+
capacityNominal Float @default(200)
|
|
330
360
|
// comments String?
|
|
331
361
|
// emptyWeight Float?
|
|
332
362
|
// gasStart DateTime?
|
|
@@ -429,12 +459,3 @@ model TorpedoTrip {
|
|
|
429
459
|
startTime DateTime @default(now()) @db.DateTimeOffset
|
|
430
460
|
endTime DateTime? @db.DateTimeOffset
|
|
431
461
|
}
|
|
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
|
-
}
|