From c15ecab79a71ac52be186fc67bbb36441de4bf64 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:41:12 +0000 Subject: [PATCH 1/4] Initial plan From c46086c3664be6198c0b0bbe58e09d7329c67516 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:43:26 +0000 Subject: [PATCH 2/4] Add GitHub Actions workflow to generate database schema diagram Co-authored-by: DevSecNinja <14926452+DevSecNinja@users.noreply.github.com> --- .github/workflows/schema-diagram.yml | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/schema-diagram.yml diff --git a/.github/workflows/schema-diagram.yml b/.github/workflows/schema-diagram.yml new file mode 100644 index 0000000..bee0e30 --- /dev/null +++ b/.github/workflows/schema-diagram.yml @@ -0,0 +1,76 @@ +--- +name: Generate Database Schema Diagram + +on: # yamllint disable-line rule:truthy + workflow_dispatch: null + push: + branches: + - main + paths: + - "backend/app/models/**" + - ".github/workflows/schema-diagram.yml" + pull_request: + branches: + - main + paths: + - "backend/app/models/**" + - ".github/workflows/schema-diagram.yml" + +permissions: + contents: read + +jobs: + generate-schema-diagram: + name: Generate Schema Diagram + runs-on: ubuntu-latest + + steps: + - name: Checkout code + # v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + persist-credentials: false + + - name: Setup Python + # v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 + with: + python-version: "3.14" + cache: "pip" + cache-dependency-path: backend/requirements.txt + + - name: Install backend dependencies + run: .github/scripts/install-backend-deps.sh + + - name: Create database with schema + working-directory: ./backend + run: | + mkdir -p data + python -c " + from app.models import init_db + init_db() + print('Database initialized with schema') + " + + - name: Generate schema diagram with SchemaCrawler + # v16.22.2 + uses: > + schemacrawler/SchemaCrawler-Action@83d8b85e5623e7a6d7fb1b33ad2ee53f8e36fa41 + with: + schemacrawler-version: "16.22.2" + entrypoint: /schemacrawler.sh + args: > + --server=sqlite + --database=./backend/data/hadiscover.db + --info-level=standard + --command=schema + --output-format=png + --output-file=database-schema.png + + - name: Upload schema diagram as artifact + # v4 + uses: actions/upload-artifact@ea054a5b3e5eb6d1e9c84e0c37291e9c0c6ddfec + with: + name: database-schema-diagram + path: database-schema.png + retention-days: 90 From 80e4632c3def76003a230bcdc6f6b6115145ae1c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:44:33 +0000 Subject: [PATCH 3/4] Add documentation about schema diagram workflow Co-authored-by: DevSecNinja <14926452+DevSecNinja@users.noreply.github.com> --- ARCHITECTURE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 9bdc9ea..d082ed9 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -79,6 +79,8 @@ SQLite Database ←→ GitHub API ## Database Schema +> **Note**: A visual schema diagram is automatically generated by the [schema-diagram workflow](.github/workflows/schema-diagram.yml) whenever database models change. The diagram is available as a build artifact in GitHub Actions. + ### repositories ```sql From d8facbe922f1f6d8f58bd470e2ca0e1d6306241b Mon Sep 17 00:00:00 2001 From: Jean-Paul van Ravensberg <14926452+DevSecNinja@users.noreply.github.com> Date: Sat, 7 Feb 2026 19:53:12 +0100 Subject: [PATCH 4/4] Update schema-diagram.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/schema-diagram.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/schema-diagram.yml b/.github/workflows/schema-diagram.yml index bee0e30..2fab214 100644 --- a/.github/workflows/schema-diagram.yml +++ b/.github/workflows/schema-diagram.yml @@ -46,11 +46,7 @@ jobs: working-directory: ./backend run: | mkdir -p data - python -c " - from app.models import init_db - init_db() - print('Database initialized with schema') - " + python -c "from app.models import init_db; init_db(); print('Database initialized with schema')" - name: Generate schema diagram with SchemaCrawler # v16.22.2