Archetype: plantuml_er.mustache

Table of Contents

PlantUML entity-relationship diagram for a schema: one entity block per table (columns flagged with {{#is_fk}}, coloured via {{color}}), relations drawn with {{cardinality}} between from_table / to_table, stamped with {{generated_at}}. Referenced by no code — only the plantuml profile entry (output output/{entity}_er.puml, untracked) names it; retained pending the profiles-drift audit, like cmake_service_src. The original file had CRLF line endings (the only template that did); the literate migration normalised it to LF.

See the Template variable reference for the complete list of available variables and their semantics.

Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/plantuml_er.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/assets.org. Edit the org source. }}
' -*- mode: plantuml; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
'
' Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
'
' This program is free software; you can redistribute it and/or modify it under
' the terms of the GNU General Public License as published by the Free Software
' Foundation; either version 3 of the License, or (at your option) any later
' version.
'
' This program is distributed in the hope that it will be useful, but WITHOUT
'  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
' FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License along with
' GNU Emacs; see the file COPYING. If not, write to the Free Software
' Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
'
' GENERATED FILE - DO NOT EDIT
' Generated: {{generated_at}}
' Regenerate with: ./projects/ores.codegen/plantuml_er_generate.sh
'
@startuml

title ORES Database Schema
hide circle
skinparam linetype ortho

' Layout: left-to-right stacks packages vertically
left to right direction
skinparam packageStyle rectangle
skinparam nodesep 8
skinparam ranksep 20

note as SchemaNote
ORES Database Schema

Packages grouped by domain:
- iam: Identity & Access Management
- assets: Digital Assets
- refdata: Reference Data
- dq_*: Data Quality (staging, datasets, methodology, metadata)
- variability, telemetry, geo: Supporting services

Table naming: <component>_<entity>_tbl
end note

{{#packages}}
'
' ==================== {{name}} ({{description}}) ====================
'
package "{{name}}" {{color}} {
{{#tables}}
    entity {{name}} {{stereotype}} {{color}} {
{{#primary_key.columns}}
        * {{name}} : {{type}} {{#is_fk}}<<PK, FK>>{{/is_fk}}{{^is_fk}}<<PK>>{{/is_fk}}
{{/primary_key.columns}}
        --
{{#columns}}
{{^is_pk}}
        {{^nullable}}* {{/nullable}}{{#nullable}}  {{/nullable}}{{name}} : {{type}}{{#is_unique}}{{#is_fk}} <<unique, FK>>{{/is_fk}}{{^is_fk}} <<unique>>{{/is_fk}}{{/is_unique}}{{^is_unique}}{{#is_fk}} <<FK>>{{/is_fk}}{{/is_unique}}
{{/is_pk}}
{{/columns}}
    }

{{#description}}
    note right of {{name}}
    {{description}}
    end note

{{/description}}
{{/tables}}
}

{{/packages}}

'
' ==================== Relationships ====================
'
{{#relationships}}
{{from_table}} {{cardinality}} {{to_table}} : "{{label}}"
{{/relationships}}

' Local Variables:
' compile-command: "java -Djava.awt.headless=true -DPLANTUML_LIMIT_SIZE=131072 -jar /usr/share/plantuml/plantuml.jar ores_schema.puml"
' End:
@enduml

See also

Emacs 29.1 (Org mode 9.6.6)