No resources generated with ash_postgres.gen.resources

I am just getting started with Elixir, Ash etc., so most likely I am missing some configuration or step here. I tried to go through the docs and code but have no luck so far.

When trying to generate a resource(s) from an existing postgres db/schema, I get the following output:

mix ash_postgres.gen.resources CfncApp.App --tables auditlog --snapshots-only
Compiling 1 file (.ex)
Generated cfnc_app app

Igniter:

    No proposed content changes!


Igniter - Warnings:

* No ecto repos configured.

But I have the following configuration:

config :cfnc_app, ecto_repos: [CfncApp.Repo]

What am I missing or doing wrong?

add -r CfncApp.Repo and you’re good :slight_smile:

Thanks @olivermt :star_struck:. Is this something that needs document update or I was missing some configuration or defaults?

That did move further, but see the following error:

** (UndefinedFunctionError) function CfcnApp.Repo.config/0 is undefined (module CfcnApp.Repo is not available)
    CfcnApp.Repo.config()

I do have the configuration in dev.exs:

config :cfnc_app, CfncApp.Repo,
  username: "cfnc",
  password: "cfnc",
  hostname: "xyz",
  database: "cfnc",
  show_sensitive_data_on_connection_error: true,
  pool_size: 10,

Hmm…this is interesting. What happens if you do mix do compile, ash_postgres.gen.resources CfncApp.App

Awesome! That worked @zachdaniel :star_struck:.

I am pretty sure I did “mix compile” before the gen.resources step. Is there a difference?

Sorry if these are noob questions. It is a lot to digest for someone coming from a Java/C++ world :grin:

1 Like

Never mind @zachdaniel, I think there was some misconfiguration in my dev.exs file. The gen.resources step step works just fine if I do everything from scratch again.

Thanks!

1 Like