@bslau/hmm_prisma_schema 1.1.23 → 1.2.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.
Files changed (2) hide show
  1. package/README.md +35 -22
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,31 +1,44 @@
1
- # Introduction
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
- # Getting Started
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
- # Build and Test
12
- TODO: Describe and show how to build your code and run the tests.
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
- # Edit prisma schema
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
- >edit schema.prisma
18
+ # Deploying Prisma Schema
19
19
 
20
- >npx prisma format
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
- >npx prisma migrate dev --name new schema
22
+ The latest version can then be installed in the application implementing the schema:
23
23
 
24
- >update version in package.json
24
+ `npm install @bslau/hmm_prisma_schema`
25
25
 
26
- >raise PR for merging to main branch
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
- 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:
29
- - [ASP.NET Core](https://github.com/aspnet/Home)
30
- - [Visual Studio Code](https://github.com/Microsoft/vscode)
31
- - [Chakra Core](https://github.com/Microsoft/ChakraCore)
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.1.23",
3
+ "version": "1.2.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",