achiku / planter Goto Github PK
View Code? Open in Web Editor NEWGenerate PlantUML ER diagram textual description from PostgreSQL tables
License: MIT License
Generate PlantUML ER diagram textual description from PostgreSQL tables
License: MIT License
Hey!
I try to install the solution by command, without success.
go get -u github.com/achiku/planter
# github.com/alecthomas/kingpin
go-1/src/github.com/alecthomas/kingpin/values.go:142:25: undefined: str2duration.Str2Duration
Many thanks for this super handy project!
I noticed a small bug: If there are two indexes on a foreign key, the relation is duplicated even though there is only one foreign key column. Here a minimal example to reproduce the issue:
For the following table definition
create table foo
(
id serial primary key
);
create table bar
(
id serial primary key,
foo_id int references foo,
name int
);
create index on bar (foo_id);
create unique index on bar (name, foo_id);
planter creates the following output
@startuml
hide circle
skinparam linetype ortho
entity "**bar**" {
+ ""id"": //serial [PK]//
--
""foo_id"": //integer [FK]//
""name"": //integer //
}
entity "**foo**" {
+ ""id"": //serial [PK]//
--
}
"**bar**" }-- "**foo**"
"**bar**" }-- "**foo**"
@enduml
whereas the correct output would be
@startuml
hide circle
skinparam linetype ortho
entity "**bar**" {
+ ""id"": //serial [PK]//
--
""foo_id"": //integer [FK]//
""name"": //integer //
}
entity "**foo**" {
+ ""id"": //serial [PK]//
--
}
"**bar**" }-- "**foo**"
@enduml
Any plant to support other DB, eg. MySQL / MSSQL?
Hi, thanks for the great tool. I made a docker file which packages planter and plantuml in one docker image: https://github.com/kimmobrunfeldt/planter-docker. This makes using the tool a one-liner assuming docker is installed.
It exposes planter and plantuml directly, but also implements er
command which allows selecting tables with a matching pattern. Useful for databases with tens or hundreds of tables.
like the title said, if i don't use foreign key, this tool won't work, is there any idea we can make this work without foreign key
Hi,
Thank you so very much for this very useful program!
Everything works well with one exception: all relations are duplicated and I cannot figure why.
Here is a simple example from a much larger PostgreSQL database:
TAG
, with a PK tag_key
CTG
(= categories), with a PK ctg_key
tag_fk
: each tag belongs or not to a categorykuq
Here is the TAG DDL for TAG
:
CREATE TABLE kuq.tag (
tag_key int4 NOT NULL,
ctg_key int4 NULL,
tag varchar(60) NULL,
CONSTRAINT tag_pk PRIMARY KEY (tag_key),
CONSTRAINT tag_un UNIQUE (tag_key)
);
CREATE INDEX tag_tag_idx ON kuq.tag USING btree (tag);
ALTER TABLE kuq.tag ADD CONSTRAINT tag_fk FOREIGN KEY (ctg_key) REFERENCES kuq.ctg(ctg_key);
When I execute:
planter postgres://<connection>?sslmode=disable \
-s kuq \
-t tag \
-t ctg \
-o test.uml
I get this PlantUML schema where the many to one link between TAG
and CTG
is duplicated:
And, in effect, the link is duplicated in the UML definition file:
@startuml
entity "ctg" {
Tag Categories
..
+ ctg_key [PK]
--
ctg_key
nam
cmt
}
entity "tag" {
Tags
..
+ tag_key [PK]
--
tag_key
ctg_key
tag
}
tag }-- ctg
tag }-- ctg
@enduml
What am I doing wrong?
Best,
Stephen
Can we do revers feature? ;) PlantUml->PostgreSQL (like this one for MySQL https://github.com/grafov/plantuml2mysql)
Would be awesome complete tool
It should be N:1.
Hi!
Great project, I'm really liking it! I just used to to run it on our live system and it's absolutely fantastic, specially for onboarding new folks :)
I just just wanted to flag with this ticket that I wasn't able to extract diagrams for tables that reference tables in other schemas. Not sure if the is a way or not? Nonetheless, still enjoying it a lot!
Best,
Javier
exception
planter postgres://user:123@localhost/adatabase?sslmode=disable
2019/11/30 16:16:48 failed to get columns of chat: failed to load table def: pq: column ad.adsrc does not exist
environment
I am running PostgreSQL inside docker from the official docker image version 12.1-alpine
I have discovered it local and tried it inside the container so docker is probably not the issue.
Database structure
It also happens in the example from the repo.
Partitions of a table are included as entities.
This can result in extremly long output, repeating the same entity with a new name (partition name) again and again.
Can partitions be skipped please.
For large schemas, it would be useful to generate the ERD without the list of columns to just show the relationships.
Perhaps with an additional option to just show PKs and FKs
Would this be considered?
I have a table called RevisionChanges which is breaking the uml generation.
Hello, is there a docker image available for this somewhere?
Would like to see more info about columns
My personal rules:
{name} {SQL type} [-- {comment}]
+
(will be displayed as green dot) with reference in comment--
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.