Create .dot diagrams from your ecto schemas. Export them to png
, svg
or pdf
.
The project it's on a very early stage, so you can expect edge cases and bugs.
The package can be installed by adding ecto_dot
to your list of dependencies in mix.exs
:
def deps do
[
{:ecto_dot, "~> 0.1.0"}
]
end
All these examples assume you have 3 Ecto schemas User
, Post
and Comment
. You can find the code in ecto_example_code.
- Generate
dot
andpng
files for the schemaUser
:
EctoDot.diagram(User)
|> EctoDot.export("examples/readme/user", [:dot, :png])
- Generate
svg
files for the schemasUser
andPost
:
EctoDot.diagram([User, Post])
|> EctoDot.export("examples/readme/user_post", [:svg])
diagram/2
only uses the schemas you passed in to form the diagram, if you find that tiring,
you can use expanded_diagram/2
which will expand the relations from the modules you pass into it.
- Generate
dot
andpng
files for all the schemas accessible fromUser
(all 3 schemas) :
EctoDot.expanded_diagram(User)
|> EctoDot.export("examples/readme/blog", [:dot, :png])
Feel free to open issues with bugs, suggest ideas and submit PRs if you are interested on this project.