Skip to content

Add automated database schema diagram generation#186

Open
Copilot wants to merge 4 commits intomainfrom
copilot/create-schema-diagram-workflow
Open

Add automated database schema diagram generation#186
Copilot wants to merge 4 commits intomainfrom
copilot/create-schema-diagram-workflow

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Adds GitHub Actions workflow to automatically generate visual database schema diagrams using SchemaCrawler.

Implementation

  • Workflow (.github/workflows/schema-diagram.yml):

    • Initializes SQLite database from SQLAlchemy models via init_db()
    • Generates PNG schema diagram using schemacrawler/SchemaCrawler-Action@v16.22.2
    • Uploads diagram as artifact (90-day retention)
    • Triggers: model changes (backend/app/models/**), PRs, pushes to main, manual dispatch
  • Documentation (ARCHITECTURE.md):

    • Added reference to workflow in Database Schema section

Artifact Access

Download database-schema-diagram from Actions tab → workflow run → Artifacts section.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create schema diagram</issue_title>
<issue_description>Use a GitHub action workflow to make a schema diagram. Example tool: https://github.com/schemacrawler/SchemaCrawler-Action</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 7, 2026 18:43
Co-authored-by: DevSecNinja <14926452+DevSecNinja@users.noreply.github.com>
Co-authored-by: DevSecNinja <14926452+DevSecNinja@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub action to generate schema diagram Add automated database schema diagram generation Feb 7, 2026
Copilot AI requested a review from DevSecNinja February 7, 2026 18:45
@DevSecNinja DevSecNinja requested review from Copilot and removed request for DevSecNinja February 7, 2026 18:46
@DevSecNinja DevSecNinja marked this pull request as ready for review February 7, 2026 18:46
@github-actions github-actions bot added documentation Improvements or additions to documentation ci/cd labels Feb 7, 2026
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd 🟢 6.4
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 57 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 6branch protection is not maximal on development and all release branches
Vulnerabilities🟢 73 existing vulnerabilities detected
SAST🟢 8SAST tool detected but not run on all commits
actions/actions/setup-python a309ff8b426b58ec0e2a45f0f869d46889d02405 🟢 5
Details
CheckScoreReason
Maintained🟢 57 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Code-Review🟢 10all changesets reviewed
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Vulnerabilities⚠️ 010 existing vulnerabilities detected
SAST🟢 9SAST tool is not run on all commits -- score normalized to 9
actions/actions/upload-artifact ea054a5b3e5eb6d1e9c84e0c37291e9c0c6ddfec 🟢 6.2
Details
CheckScoreReason
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Code-Review🟢 10all changesets reviewed
Maintained🟢 1027 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Vulnerabilities🟢 64 existing vulnerabilities detected
SAST🟢 10SAST tool is run on all commits
actions/schemacrawler/SchemaCrawler-Action 83d8b85e5623e7a6d7fb1b33ad2ee53f8e36fa41 🟢 5.2
Details
CheckScoreReason
Code-Review⚠️ 0Found 0/20 approved changesets -- score normalized to 0
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Maintained🟢 1023 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy⚠️ 0security policy file not detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Packaging🟢 10packaging workflow detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • .github/workflows/schema-diagram.yml

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.82%. Comparing base (5ef89f3) to head (d8facbe).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #186   +/-   ##
=======================================
  Coverage   71.82%   71.82%           
=======================================
  Files          11       11           
  Lines         802      802           
  Branches      124      124           
=======================================
  Hits          576      576           
  Misses        163      163           
  Partials       63       63           
Flag Coverage Δ
backend 71.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated generation of a visual SQLite database schema diagram as a GitHub Actions artifact, and documents where to find it in the architecture docs.

Changes:

  • Introduces a new GitHub Actions workflow to initialize the SQLite schema from SQLAlchemy models and generate a PNG diagram via SchemaCrawler.
  • Uploads the generated diagram as a GitHub Actions artifact (90-day retention).
  • Updates architecture documentation to reference the new workflow and artifact location.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ARCHITECTURE.md Adds a note pointing readers to the schema-diagram workflow and its generated artifact.
.github/workflows/schema-diagram.yml New workflow to build a SQLite DB schema and generate/upload a SchemaCrawler PNG diagram.

Comment on lines 47 to 53
run: |
mkdir -p data
python -c "
from app.models import init_db
init_db()
print('Database initialized with schema')
"
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow adds an inline multi-line run: | script. Repo guidance in .github/copilot-instructions.md (Workflow Scripts section) requires multi-line workflow scripts to be extracted into files under .github/scripts/ for maintainability/testability. Consider moving the DB-init logic into a dedicated script (or reuse an existing one) and invoke it here.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create schema diagram

3 participants