Skip to content

Add DBML and D2 support from Kroki

Bruno Obsomer requested to merge bobzomer/gitlab:support-dbml-from-kroki into master

What does this MR do and why?

Gitlab already supports drawing diagrams with Kroki, either from https://kroki.io/ or from self-hosted kroki instance.

Now Kroki also supports drawing database diagrams with the DBML language (see https://www.dbml.org) through a tool called dbml-renderer (https://github.com/softwaretechnik-berlin/dbml-renderer).

This merge request only extends the list of supported diagrams to include DBML too.

Screenshots or screen recordings

No idea how to run a modified instance of Gitlab.

How to set up and validate locally

  1. Ensure your Gitlab instance is configured to use kroki, either from https://kroki.io/ or from an up-to-date self-hosted kroki instance.
  2. Create any markdown text into Gitlab (issue, comment, etc.)
  3. Use ```dbml to provide a diagram in DBML. Example:
       ```dbml
       Table users {
         id integer
         username varchar
         role varchar
         created_at timestamp
       }
       
       Table posts {
         id integer [primary key]
         title varchar
         body text [note: 'Content of the post']
         user_id integer
         status post_status
         created_at timestamp
       }
       
       Enum post_status {
         draft
         published
         private [note: 'visible via URL only']
       }
       
       Ref: posts.user_id > users.id // many-to-one
  4. In preview or visualization, the DBML should be replaced by the same image as kroki dbml

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Bruno Obsomer

Merge request reports

Loading