ash.gen.resource warning can not add to resource list
I'm a total noobie to ash and phoenix. I'm getting a bit stuck on a point where i think the user experience could be a bit better.
I ran mix igniter.new fitness --install ash,ash_sqlite,ash_phoenix --with phx.new --extend sqlite
After that i want to run
mix ash.gen.resource Fitness.Exercise \
--attribute title:string:required \
--attribute category:string:required \
--attribute filename:string:required \
--attribute upload_date:date \
--attribute daily_quota:integer \
--uuid-primary-key id \
--relationship has_many:repetitions:FitnessAsh.Repetition \
--default-actions read,create,update,destroy \
--extend ash_sqlite \
--timestamps
And i see
Igniter - Warnings:
* Domain Elixir.Fitness was not an `Ash.Domain`, so could not add `Fitness.Exercise` to its resource list.
It's not clear to me whether:
- I need to add it to the resource list myself
- I am not supposed to generate ash models in the existing domain. (I thought later this domain is phoenix-only)
- I need to create a new domain for ash first before continuing here
- It was not a good choice to generate a new project with
--with phx.newfor a new user and this is more for advanced users who know how to integrate ash with phoenix better
Reasoning number 2 seems the most apt.
https://elixirforum.com/t/ash-gen-resource-fails-partially-if-resource-is-top-level/65535
@albinkc thanks that seems to be the way to go
Is there any opportunity to improve UX here by putting the solution into the Ignitor warning or in another place so that it pops up in the terminal? Like this bit "so could not add Fitness.Exercise to its resource list" doesn't really seem like something you would want to do, does it?
What I think we should actually do here is say "X existed but is not an Ash.Domain, should we add use Ash.Domain to the module?"