Skip to content

Entity Relationship Diagram to Mermaid Github Action

Notifications You must be signed in to change notification settings

ndesaunais/erd-ga

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Database Entity Relationship diagram (ERD) as Mermaid format

Dev setup (using mise)

Install mise and activate it.

mise activate

It will install the required tools in .mise.toml namely poetry and python.

Now you can run the following commands

poetry env use 3.11.9
poetry install --all-extras --with dev
poetry shell

Run tests

Pytest is a dev dependency of this project.

poetry run pytest

The tests leverages testcontainers to you would need docker to be installed on your systeM

Dev Container

A dev container is provided for ci purpose, it's an alternative to setup your dev environment.

Github action

ga_test.yaml provides an example of how the github action can be used

You would need to add to your existing github worklow the following.

- name: ERD action step
  uses: ndesaunais/erd-ga@master
  id: erd
  with:
    url: postgresql://user:passwd@host:port/db_name
    output: out.mmd

This github action requires:

  • url, a database url in the format postgresql://user:passwd@host:port/db_name that enables connection to a running datbase
  • output, a filepath where to generate the mermaid file

ga_test.yaml provides an example of how to run a database as a github action service and how to provide the correct url

The output can be used by the ci to generate a commit and dump the new updated schema. To access the content of the file in the following step, you can use ${{ github.workspace }}/out.mmd.

Todos

  • Generate a docker image to prevent checkout
  • Use an appropriate mermaid generator

About

Entity Relationship Diagram to Mermaid Github Action

Resources

Stars

Watchers

Forks

Packages