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

Don't generate dbml refs for embedded schemas #50

Closed DReigada closed 1 year ago

DReigada commented 1 year ago

Currently for embedded schemas that reference other schemas, the generated dbml file is invalid.

Example:

This schema

typed_schema "my_schema" do
  embeds_many :embedded_schema, EmbeddedSchema, on_replace: :delete, primary_key: false do
    field(:my_field, :string)

    belongs_to(:other_schema, OtherSchema, primary_key: true, type: :binary_id)
  end
end

Generate a Ref "line" like the following (notice the empty string):

Ref: other_schema.id < "".other_schema_id

This PR changes the behaviour to ignore lines like this.

fuelen commented 1 year ago

Thank you!