Macro database-structure
Purpose
Visualize the structure of a database.This macro was added in version 5.3.3 of the PlantUML Plugin und removed in version 2023.3 (with the Confluence 8 support)
Parameter
Parameter datasource is required, all others are optional.
Name | Description |
---|---|
datasource | Name of datasources to visualize Datasources must be configured by a Confluence administrator before they can be used. |
schemaName | Name of schema to visualize. The table name is prefixed with the schema name if none is selected. |
tableTypes | Comma separated list of types to show in graphics. The available types depend on the database. They can be determined with the database-info macro. Common ones are:
The type will be shown as stereotype above the table name if more than one is selected. |
tableNameFilter | Show only tables with these names in generated graphic. Wildcards _ and % can be used as in a SQL SELECT. An additional filtering is possible with tableNameRegEx. Note
|
columnNameFilter | Show only columns with these names in generated graphic. It works like tableNameFilter. |
tableNameRegEx | Show only tables with these names in generated graphic. Table names are defined as regular expression, e.g. show all tables whose names start with A,B,C or D or end with NEW: ([A-D].*|.*NEW) Note
|
columnNameRegEx | Show only columns with these names in generated graphic. It works like tableNameRegEx. |
showColumns | If true column names and their data types are shown. |
showComments | If Note: Comments are an elegant way to document a database schema but they are not part of the SQL standard. Some databases support them (e.g. PostgreSQL, Oracle), others do not (MySQL). (available since 5.4.1) |
showDefaultValues | If (available since 5.4.1) |
showIndexes | If Indexes can also be shown as separate boxes by adding |
useForeignKeys | If (available since 5.4.1) |
relationRegEx | Relations between tables can also be drawn without foreign key constraints. This requires a consistent naming schema and a regular expression to describe how tables are related. The regular expression is checked against: A relation between table <tablename1> and <tablename2> is drawn when the regular expression matches. Example: person.id team.person_id team.id match.team_id ... The following regular expression would do this: ^(.*)\.id .*\.\1_id$ Note: Only tables and columns which are shown in the output will be used the determine relations! (available since 5.4.1) |
nodeFontsize | Font size. Default is 9 . |
additional | The appearance of the graphics can be changed by adding some DOT commands here. This will overwrite the default set by the macro. Example: set minimal width of all table boxes to 3.5 inches, change background, font colour and font: node [ width="3.5", fontcolor="#FFFFFF", fillcolor="#222222", fontname="Serif"]; For more details see http://www.graphviz.org/doc/info/attrs.html. |
format | PNG (default) SVG (beta) |
exportName | The graph will be stored as attachment if exportName is given. |
debug |
|
Sample Images
Sample Code
{database-structure:datasource=jira|showIndexes=true|showColumns=false} {database-structure:datasource=confluence|schemaName=public|tableTypes=TABLE|tableNameFilter=os_%|nodeFontsize=11| additional=node [ width="3.5", fontcolor="#FFFFFF", fillcolor="#222222", fontname="Serif"];}
Macro Browser
Logging
You can increase the logging output which is sent to $confluence.home/log/atlassian-confluence.log to see what happens inside the macro.
- Class/Package Name: de.griffel.confluence.plugins.plantuml
- Loglevel INFO will output
- DOT file from which the graphic is generated
- measurements how long it took to retrieve tables, columns, foreign keys and who long it took to create DOT and graphic
- Loglevel DEBUG will additionally output
- each table, column, foreign key and idex which was retrieved from the database