Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Entity Relationship Diagrams #560

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Entity Relationship Diagrams #560

wants to merge 3 commits into from

Conversation

engineervix
Copy link
Member

@engineervix engineervix commented Dec 22, 2023

The changes introduced here allow for creating entity relationship diagrams via django-extensions and graphviz.

This may be helpful in the early stages of the implementation of the new design, as we look at things such as the field specification and harmonisation of field names / attrributes between FE and BE.

The intention is not to merge this to the main branch, but rather to serve as reference. To be closed when no longer needed.

To generate a diagram:

  1. checkout the diagrams branch and build the Docker images

    git checkout diagrams && \
    fab build
  2. Spin up the containers, and SSH into the web container

    fab start && fab sh
  3. In the container, run

    ./manage.py graph_models \
     blog \
     events \
     impact_reports \
     navigation \
     people \
     propositions \
     services \
     sign_up_form \
     taxonomy \
     torchbox \
     work \
     images \
     --pygraphviz --rankdir BT -o er_diagram.png

What we are doing above is generating a diagram for specified Django apps on the project. Feel free to modify the above command as you please. See https://django-extensions.readthedocs.io/en/latest/graph_models.html#example-usage for usage examples.

Note

If, for some reason, you don't see the generated file on your computer (this happened to me), then copy it from the docker container to the local filesystem. Here's what I did

docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED              STATUS              PORTS                                                                                                      NAMES
d7bfc727cc4e   wagtail-torchbox_web   "tail -f /dev/null"      About a minute ago   Up About a minute   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp, 0.0.0.0:8000-8001->8000-8001/tcp, :::8000-8001->8000-8001/tcp   wagtail-torchbox_web_1
4c5f1bed9f62   postgres:13.12         "docker-entrypoint.s…"   2 hours ago          Up About a minute   5432/tcp                                                                                                   wagtail-torchbox_db_1
761fb77de157   redis:6.0              "docker-entrypoint.s…"   2 hours ago          Up About a minute   6379/tcp                                                                                                   wagtail-torchbox_redis_1docker cp d7bfc727cc4e:/app/er_diagram.png er_diagram.png

@engineervix engineervix self-assigned this Dec 22, 2023
@engineervix engineervix marked this pull request as draft December 22, 2023 12:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant