@bslau/hmm_prisma_schema
v1.21.2
Published
HMM PRISMA Schema
Downloads
202
Keywords
Readme
Editing Prisma Schema
The general workflow will follow these steps:
- Create and checkout a new working branch.
- Edit
schema.prismaas needed. - Run automated formatting:
npm run prisma:format - Prepare database changes (as needed):
- create (preview) migration:
npm run prisma:createor; - create and apply migration:
npm run prisma:apply
- create (preview) migration:
- Update minor version number in
package.json"version": "[MAJOR].[MINOR].[PATCH]" - Create and test new seeding function(s) if required - being cautious to avoid creating duplicate records on repeated runs.
- Raise PR for merging back into main branch.
The changes should be ready for review, merging, and publishing now.
Deploying Prisma Schema
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.
The latest version can then be installed in the application implementing the schema:
npm install @bslau/hmm_prisma_schema
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.
Manual Deployment for Test Environment
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.
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):
RDP into the host server:
ITAVWEB91Open a bash terminal and navigate to the installed package:
C:\inetpub\wwwroot\hmm\graphql_server\node_modules\@bslau\hmm_prisma_schemaApply any pending migrations:
npm run prisma:deployRun the seed function to create data:
npm run prisma:seed
At this point, assuming no errors in deploying or seeding, the Test database schema should be synchronised with Prisma now.
