kurotych / sqlant

Generate PlantUML/Mermaid ER diagram textual description from SQL connection string
MIT License
22 stars 1 forks source link

Error in generated PlantUML #23

Closed jayvdb closed 6 months ago

jayvdb commented 6 months ago
Error found in diagram erd
ERROR
5
Syntax Error?
Some diagram description contains errors

The generated source is

@startuml 

hide circle
skinparam linetype ortho

"**butane_migrations**" {
# <b>""name""</b>: //""text"" <b><color:goldenrod>(PK) </color></b><b><color:DarkRed>(NN) </color></b> //
---
}

@enduml
kurotych commented 6 months ago

Could you give me a pg dump so I can reproduce this?

jayvdb commented 6 months ago

Unfortunately not.

The table DDL for one of the tables, the one mentioned above, is

CREATE TABLE IF NOT EXISTS butane_migrations (
"name" TEXT NOT NULL PRIMARY KEY
);
kurotych commented 6 months ago

Thanks @jayvdb This is enough for reproduce. I will fix

jayvdb commented 6 months ago

I suspect the problem is that because there are no relationships between entities, plantuml doesnt detect the type of diagram, and fails.

The mermaid diagram shows each table separately. i.e. disconnected.

jayvdb commented 6 months ago

I've added all the relationships, and the mermaid diagram looks well connected. The plantuml is still failing to render.

kurotych commented 6 months ago

The plantuml is still failing to render.

I've found at least one reason Plantuml has failed. It now required the "class" keyword. Fixing...

kurotych commented 6 months ago

@jayvdb could you try this fix? https://github.com/kurotych/sqlant/pull/24/files#diff-d94002e7bd41ac4a55adfe026b3b0b387c251b5fe1d2857e9aa7cd58f0276212

jayvdb commented 6 months ago

Thanks a heap for figuring that out. If this crate isnt ready for a release, I can use a git dependency in my Cargo.toml

kurotych commented 6 months ago

I will release version 0.3 today

kurotych commented 6 months ago

New version is released https://crates.io/crates/sqlant