Skip to content

Setup SchemaSpy for Auto Generating Data Model

MCatherine edited this page Aug 13, 2024 · 7 revisions

SchemaSpy Setup

  • We created a GitHub Action pipeline from the yaml file, which can be triggered manually or triggered automatically when run production deployment
    • The pipeline first creates the random database username and password
    • And then it will setup the basic Postgres container with the random username and password created in the above step
    • And then it will run the flyway script (Please note that: because our flyway script uses some variables like api_db_username etc., we need to put some placeholders for these variables, just copy the same ones from our docker compose file, the value doesn't matter)
    • And then it will create the folder where we want to put the SchemaSpy content
    • In the step to run SchemaSpy, we pass our database name and schema name
    • In the last step, it deploys SchemaSpy generated content from previous folder to a branch named "gh-pages" and updates to the Github Pages
  • When we run the pipeline, it auto created a new branch gh-pages. The SchemaSpy content will be under the root directly of that branch, which includes all the data model information we need
  • Since this is the first time we run this pipeline, when we finished running the pipeline, we went to the "Settings->Pages" and deployed the GitHub Pages from the "gh-pages" branch. The Page is available at: https://bcgov.github.io/nr-forests-access-management/ with all the data model information we need
Screen Shot 2024-08-12 at 4 21 33 PM

SchemaSpy Maintainance

  • The pipeline will be triggered automatically when we do production deployment, so it will auto update "gh-pages" branch and the Github Pages to display the latest data model. We can also manually trigger the pipeline to do the update if there is any need
  • Added a branch protection rule for "gh-pages", so that this branch will not be deleted accidentally
Clone this wiki locally