Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Manage Vehicles DB schema and DB version management process #85

Merged
merged 10 commits into from
Dec 27, 2022

Conversation

john-fletcher-aot
Copy link
Collaborator

@john-fletcher-aot john-fletcher-aot commented Dec 22, 2022

Description

DDL for Manage Vehicles, previously stored in /database/mssql/ddl/sample_ddl.sql has been moved into /database/mssql/scripts/versions/ directory.

DDL is implemented as individual DDL script files to be applied in sequential order, starting at version 1 and up to version x, where x is the most recent version of the ORBC database. Individual script files are named according to a pattern recognized by the sql server container startup shell script. Comments are in the shell scripts, located at /database/mssql/*.sh.

This is the first step towards allowing us to normalize the process required to keep the SQL Server databases in sync between dev, test, and production. Also, it is compatible with the standard MOTI process for incrementing production database versions with incremental script file executions.

Note this commit requires that developers use a local .env file to store environment variable secrets (and other not-quite-so-secret configuration). Details of the .env file have been posted to the devs MS Teams conversation.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Run docker compose run --build -d sql-server-db, verify container starts successfully
  • Once sql-server-db container running successfully, connect using SQL Server Management Studio and inspect the database schema to ensure it matches the DDL (all 7 tables have been created, etc).
  • When connected in SSMS, inspect the ORBC_SYS_VERSION table to ensure both versions (1 and 2) are represented with descriptions accurately

Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have already been accepted and merged

Further comments

The versioning approach was influenced by the TypeORM migrations pattern, but allows for compatibility with MOTI database standards. MOTI DBAs will be responsible for executing DDL for each version upgrade in production, and they require SQL DDL instead of TypeScript or JavaScript which TypeORM migrations use.

Manually creating DDL instead of using TypeORM to generate DDL for us allows us to include additional required elements such as table and column comments, and allows us to be flexible with respect to the data types we use.


Thanks for the PR!

Any successful deployments (not always required) will be available below.
Backend available
Frontend available

Once merged, code will be promoted and handed off to following workflow run.
Main Merge Workflow

@sonarcloud
Copy link

sonarcloud bot commented Dec 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@devin-aot
Copy link
Contributor

Successfully ran the following tests:

  • Run docker compose run --build -d sql-server-db, verify container starts successfully
  • Once sql-server-db container running successfully, connect using SQL Server Management Studio and inspect the database schema to ensure it matches the DDL (all 7 tables have been created, etc).
  • When connected in SSMS, inspect the ORBC_SYS_VERSION table to ensure both versions (1 and 2) are represented with descriptions accurately

Screenshot:
image

@devin-aot devin-aot merged commit 4fc962a into main Dec 27, 2022
@devin-aot devin-aot deleted the ORV2-301 branch December 27, 2022 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants