fuelen / ecto_erd

A mix task for generating Entity Relationship Diagram from Ecto schemas available in your project.
Apache License 2.0
215 stars 15 forks source link

Grouping mechanism to generate multiple smaller diagrams #48

Closed grantwest closed 1 year ago

grantwest commented 1 year ago

After a project reaches a certain size the diagram starts to become so large it loses usefulness. What if we could optionally group schemas and then generate one diagram per group. Schemas can appear in zero or more groups. A simple solution might be something like defining a function in each schema to define the groups it belongs to:

def erd_groups(), do: [:project, :accounting]

Now this schema would make an appearance in the project and accounting diagrams. It's a little bit of configuration built right into the schemas that makes the diagrams a whole lot more readable.

I don't think it HAS to be built into the code, but I think it helps people remember to update/add it when they add a new schema. But I think it would be ok if the configuration was external to the schema. Keeping it in .ecto_erd.exs is also an acceptable option. Or maybe implementing a tag?

fuelen commented 1 year ago

It is already possible to do so. Check these examples:

You can use ENV to select only a specific cluster/subset of clusters, or just create multiple .ecto_erd.exs files.

fuelen commented 1 year ago

@grantwest is your issue solved?