asciidoctorj-liquibase-extension icon indicating copy to clipboard operation
asciidoctorj-liquibase-extension copied to clipboard

An AsciidoctorJ extension to generate an entity relationship model based on liquibase changesets

:icons: font :version: 1.0-SNAPSHOT :imagesdir: doc/images = AsciidoctorJ Liquibase Extension

image:https://github.com/uniqueck/asciidoctorj-liquibase-extension/actions/workflows/ci.yaml/badge.svg?branch=master["GitHub Actions", link="https://github.com/uniqueck/asciidoctorj-liquibase-extension/actions/workflows/ci.yaml?branch=master"] image:https://img.shields.io/badge/License-MIT-yellow.svg["MIT License", link="https://opensource.org/licenses/MIT"] image:https://maven-badges.herokuapp.com/maven-central/de.uniqueck.asciidoctorj.extensions/asciidoctorj-liquibase-extension/badge.svg?style=plastic[link="https://maven-badges.herokuapp.com/maven-central/de.uniqueck.asciidoctorj.extensions/asciidoctorj-liquibase-extension"]

This AsciidoctorJ extension provides a macro to generate a entity relationship diagram based on https://www.liquibase.org/index.html[liquibase] changeset files. Currently only xml format for liquibase changeset files are supported. This extensions needs asciidoctor-diagram extension to work probably.

== Installation

To use this extension declare it as a dependency in https://github.com/asciidoctor/asciidoctor-maven-plugin[asciidoctor-maven-plugin] configuration or https://asciidoctor.org/docs/asciidoctor-gradle-plugin/[asciidoctor-gradle-plugin].

Prerequisites:

  • graphviz - https://graphviz.org/

[subs="attributes, verbatim"] [source, xml]

org.asciidoctor asciidoctor-maven-plugin LATEST output-html generate-resources process-asciidoc html com.uniqueck asciidoctorj-liquibase-extension LATEST ----

<1> asciidoctorj-liquibase-extension is added <2> check for the latest version at https://maven-badges.herokuapp.com/maven-central/de.uniqueck.asciidoctorj.extensions/asciidoctorj-liquibase-extension[Maven central]

== How To Use

.liquibase macro without attributes [source, asciidoc]

liquibase::src/test/resources/db/db.changelog-master.xml[]

.Generated image for liquibase macro image::db.changelog-master.png[]

.liquibase macro with attribute tillTag set to 1.X.FINAL [source, asciidoc]

liquibase::src/test/resources/db/db.changelog-master.xml[tillTag=1.X.FINAL]

.Generated image for liquibase macro with attribute tillTag image::db.changelog-master_1.X.FINAL.png[]

.liquibase macro with attribute fileName set to diagram [source, asciidoc]

liquibase::src/test/resources/db/db.changelog-master.xml[fileName = diagram]

.liquibase macro with attribute outputFormat set to svg [source, asciidoc]

liquibase::src/test/resources/db/db.changelog-master.xml[fileName = diagram, outputFormat = svg]

=== Attributes

  • tillTag parse liquibase changeset files only until tagDatabase matched definied value
  • fileName generates a diagram with the specified file name.
  • outputFormat generates a diagram with the specified format. Only png and svg formats are supported.

Note: the fileName attribute has to be present for the output format to be considered.

== ToDo

  • Styling of PlantUML like https://about.draw.io/entity-relationship-diagrams-with-draw-io/[Draw IO]

  • Support both styles of ERD

  • Styling options ** with or without datatypes ** line connections

  • see for grouping and associations http://plantuml.com/de/class-diagram

  • see for entity relationship diagram http://plantuml.com/de/ie-diagram

  • define how to detect cardinality of relationships