Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/schema-diagram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
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
2 changes: 2 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading