I am trying to design DB tables with PlantUML class diagrams. But I face a weird behaviour - the order of of fields is not respected. How to show the fields in the original order?
This is a minimum reproducible scenario, the changes are bigger in other classes. PlantUML also draws separator lines randomly.
@startuml
class report_document_types {
* id: VARCHAR(20)
* name: VARCHAR(255)
* is_active: CHAR(1)
* updated_by: VARCHAR(100)
* update_ts: DATE
}
@enduml
As @albert said in his comment, PlantUML considers elements with ()
to be methods. Here's what the documentation for PlantUML says:
You can use
{field}
and{method}
modifiers to override default behaviour of the parser about fields and methods.
Applying it to your example gives the expected result:
@startuml
class report_document_types {
{field}* id: VARCHAR(20)
{field}* name: VARCHAR(255)
{field}* is_active: CHAR(1)
{field}* updated_by: VARCHAR(100)
* update_ts: DATE
}
@enduml