I am starting a project with Ash and Phoenix. I take the general steps shown in the Get Started with Ash and Phoenix tutorial on the Ash documentation website. I create an Ash domain and resources. I set up the repo for the project. I add the Ash domains to the config.exs
file.
config :forum_app,
ash_domains: [ForumApp.Forum],
ecto_repos: [ForumApp.Repo],
generators: [timestamp_type: :utc_datetime]
When I run the mix ash.codegen
command to create the initial database migration. I get the following error message in the Terminal:
(UndefinedFunctionError) function ForumApp.Forum.config/0 is undefined or private
(forum_app 0.1.0) ForumApp.Forum.config()
(ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:160: AshPostgres.MigrationGenerator.snapshot_path/2
(ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:168: anonymous fn/2 in AshPostgres.MigrationGenerator.create_extension_migrations/2
(elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:53: AshPostgres.MigrationGenerator.generate/2
(mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
(elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
The database tables for my Ash resources are not created because of this error.
I have been able to create migrations in other Ash projects so I have made a mistake somewhere. But when I look at the code from the new project and compare it with similar code from other projects, I’m not seeing where my mistake is.
Where is the config
function created for an Ash domain? Where should I be looking to fix this compiler error?