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

Errors when running inside an umbrella application #29

Closed brainlid closed 2 years ago

brainlid commented 2 years ago

I have a "core" app with the majority of my Ecto schemas. Then I have a "web" app that depends on "core". The "web" app also introduces some embedded Ecto schemas that are used for form validation but not tied to a DB table.

When I run it on this project, I get the following error:

$ mix ecto.gen.erd
** (RuntimeError) Unable to detect `:otp_app`, please specify it explicitly
    (ecto_erd 0.5.0) lib/mix/tasks/ecto.gen.erd.ex:143: Mix.Tasks.Ecto.Gen.Erd.run/1
    (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.4) lib/mix/cli.ex:84: Mix.CLI.run_task/2

I tested it on a non-umbrella application (standard Phoenix app) and it worked.

fuelen commented 2 years ago

Hi @brainlid

This is mentioned in docs. You must set opt_app using configuration file if you want to run the task from umbrella root. Also, you can try to change directory to apps/core or to apps/web and run task there.

brainlid commented 2 years ago

@fuelen Thanks for the tip! I didn't open the docs and went off the README. Are you open to a PR in the README to update that and link to the online docs?

brainlid commented 2 years ago

It worked well by running it from the directory of an application in apps/. Thanks!

fuelen commented 2 years ago

Yes, but the link to docs is already present at the bottom of README :)

fuelen commented 2 years ago

I'll close the issue. If you wish to improve the docs, PRs are welcome :slightly_smiling_face: