albin

albin

% mix igniter.new helpdesk \
  --install ash,ash_postgres \
  --with phx.new \
  --extend postgres
* creating helpdesk/lib/helpdesk/application.ex
* creating helpdesk/lib/helpdesk.ex
* creating helpdesk/lib/helpdesk_web/controllers/error_json.ex
* creating helpdesk/lib/helpdesk_web/endpoint.ex
* creating helpdesk/lib/helpdesk_web/router.ex
* creating helpdesk/lib/helpdesk_web/telemetry.ex
* creating helpdesk/lib/helpdesk_web.ex
* creating helpdesk/mix.exs
* creating helpdesk/README.md
* creating helpdesk/.formatter.exs
* creating helpdesk/.gitignore
* creating helpdesk/test/support/conn_case.ex
* creating helpdesk/test/test_helper.exs
* creating helpdesk/test/helpdesk_web/controllers/error_json_test.exs
* creating helpdesk/lib/helpdesk/repo.ex
* creating helpdesk/priv/repo/migrations/.formatter.exs
* creating helpdesk/priv/repo/seeds.exs
* creating helpdesk/test/support/data_case.ex
* creating helpdesk/lib/helpdesk_web/controllers/error_html.ex
* creating helpdesk/test/helpdesk_web/controllers/error_html_test.exs
* creating helpdesk/lib/helpdesk_web/components/core_components.ex
* creating helpdesk/lib/helpdesk_web/controllers/page_controller.ex
* creating helpdesk/lib/helpdesk_web/controllers/page_html.ex
* creating helpdesk/lib/helpdesk_web/controllers/page_html/home.html.heex
* creating helpdesk/test/helpdesk_web/controllers/page_controller_test.exs
* creating helpdesk/lib/helpdesk_web/components/layouts/root.html.heex
* creating helpdesk/lib/helpdesk_web/components/layouts/app.html.heex
* creating helpdesk/lib/helpdesk_web/components/layouts.ex
* creating helpdesk/priv/static/images/logo.svg
* creating helpdesk/lib/helpdesk/mailer.ex
* creating helpdesk/lib/helpdesk_web/gettext.ex
* creating helpdesk/priv/gettext/en/LC_MESSAGES/errors.po
* creating helpdesk/priv/gettext/errors.pot
* creating helpdesk/priv/static/robots.txt
* creating helpdesk/priv/static/favicon.ico
* creating helpdesk/assets/js/app.js
* creating helpdesk/assets/vendor/topbar.js
* creating helpdesk/assets/css/app.css
* creating helpdesk/assets/tailwind.config.js

Fetch and install dependencies? [Yn]
* running mix deps.get
* running mix assets.setup
* running mix deps.compile

We are almost there! The following steps are missing:

    $ cd helpdesk

Then configure your database in config/dev.exs and run:

    $ mix ecto.create

Start your Phoenix app with:

    $ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phx.server

    warning: redefining module Helpdesk.MixProject (current version defined in memory)
    │
  1 │ defmodule Helpdesk.MixProject do
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ mix.exs:1: Helpdesk.MixProject (module)

** (FunctionClauseError) no function clause matching in Igniter.Code.Function.move_to_function_call_in_current_scope/4

    The following arguments were given to Igniter.Code.Function.move_to_function_call_in_current_scope/4:

        # 1
        {:ok, #Sourceror.Zipper<
           #...
           {:__block__, [], [{:use, [trailing_comments: [], leading_comments: [], end_of_expression: [newlines: 1, line: 4, column: 36], line: 2, column: 3], [AshPostgres.Repo, [{{:__block__, [trailing_comments: [], leading_comments: [], format: :keyword, line: 3, column: 5], [:otp_app]}, {:__block__, [trailing_comments: [], leading_comments: [], line: 3, column: 14], [:helpdesk]}}]]}, {:def, [trailing_comments: [], leading_comments: [], end_of_expression: [newlines: 1, line: 4, column: 4], do: [line: 1, column: 26], end: [line: 4, column: 1], line: 1, column: 1], [{:installed_extensions, [trailing_comments: [], leading_comments: [], line: 1, column: 5], nil}, [{{:__block__, [trailing_comments: [], leading_comments: [], line: 1, column: 26], [:do]}, {:__block__, [trailing_comments: [], leading_comments: [%{line: 2, text: "# Add extensions here, and the migration generator will install them.", column: 3, next_eol_count: 1, previous_eol_count: 1}], end_of_expression: [newlines: 1, line: 3, column: 20], closing: [line: 3, column: 19], line: 3, column: 3], [[{:__block__, [trailing_comments: [], leading_comments: [], delimiter: "\"", line: 3, column: 4], ["ash-functions"]}]]}}]]}]}
         >}

        # 2
        :defmodule

        # 3
        2

        # 4
        #Function<6.124466779/1 in Igniter.Code.Function.move_to_function_call_in_current_scope/3>

    Attempted function clauses (showing 3 out of 3):

        def move_to_function_call_in_current_scope(+zipper+, +name+, -[arity | arities]-, +predicate+)
        def move_to_function_call_in_current_scope(+_+, +_+, -[]-, +_+)
        def move_to_function_call_in_current_scope(-%Sourceror.Zipper{} = zipper-, +name+, +arity+, +predicate+)

    (igniter 0.3.19) lib/igniter/code/function.ex:85: Igniter.Code.Function.move_to_function_call_in_current_scope/4
    (igniter 0.3.19) lib/igniter/code/module.ex:482: Igniter.Code.Module.move_to_module_using/2
    (ash_postgres 2.2.1) lib/mix/tasks/ash_postgres.install.ex:347: Mix.Tasks.AshPostgres.Install.configure_min_pg_version_function/1
    (igniter 0.3.19) lib/igniter/code/module.ex:94: Igniter.Code.Module.find_and_update_module/3
    (igniter 0.3.19) lib/igniter/code/module.ex:29: Igniter.Code.Module.find_and_update_or_create_module/5
    (ash_postgres 2.2.1) lib/mix/tasks/ash_postgres.install.ex:14: Mix.Tasks.AshPostgres.Install.igniter/2
    (elixir 1.17.1) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
    (igniter 0.3.19) lib/igniter/util/install.ex:115: Igniter.Util.Install.run_installers/5

Showing Posts 1 to 3

zachdaniel

zachdaniel

Creator of Ash

Thanks for the report, fixed in v2.2.2

albin

albin OP

the igniter.new installer from the original post skips out on ash-functions. Manually running mix igniter.install ash_postgres gives me this warning:

mix igniter.install ash_postgres
===> Analyzing applications...
===> Compiling telemetry
===> Analyzing applications...
===> Compiling telemetry_poller
==> picosat_elixir
make: Nothing to be done for `all'.
==> stellar
Compiling 17 files (.ex)
warning: Please define `min_pg_version/0` in repo module: Stellar.Repo

For example:

    def min_pg_version do
      %Version{major: 16, minor: 0, patch: 0}
    end

The lowest compatible version is being assumed.

  (elixir 1.17.1) src/elixir.erl:386: :elixir.eval_external_handler/3
  (stdlib 6.0) erl_eval.erl:904: :erl_eval.do_apply/7
  (stdlib 6.0) erl_eval.erl:271: :erl_eval.exprs/6
  (elixir 1.17.1) src/elixir.erl:364: :elixir.eval_forms/4
  (elixir 1.17.1) src/elixir_module.erl:470: :elixir_module.expand_callback/6
  (stdlib 6.0) lists.erl:2151: :lists.foldl_1/3

warning: AshPostgres: You have not installed the `ash-functions` extension.

The following features will not be available:

- atomics (using the `raise_ash_error` function)
- `string_trim` (using the `ash_trim_whitespace` function)
- the `||` and `&&` operators (using the `ash_elixir_and` and `ash_elixir_or` functions)

To address this warning, do one of two things:

1. add the `"ash-functions"` extension to your `installed_extensions/0` function, and then generate migrations.

    def installed_extensions do
      ["ash-functions"]
    end

If you are *not* using the migration generator, but would like to leverage these features, follow the above instructions,
and then visit the source for `ash_postgres` and copy the latest version of those functions into your own migrations:

2. disable this warning, by adding the following to your `use` statement:

    use AshPostgres.Repo,
      ..
      warn_on_missing_ash_functions?: false

Keep in mind that if you disable this warning, you will not be able to use the features mentioned above.
If you are in an environment where you cannot define functions, you will have to use the second option.


https://github.com/ash-project/ash_postgres/blob/main/lib/migration_generator/ash_functions.ex

  (elixir 1.17.1) src/elixir_module.erl:461: anonymous fn/6 in :elixir_module.expand_callback/6
  (elixir 1.17.1) src/elixir_module.erl:460: :elixir_module.expand_callback/6
  (stdlib 6.0) lists.erl:2146: :lists.foldl/3
  (elixir 1.17.1) src/elixir_module.erl:198: :elixir_module.compile/7
  (elixir 1.17.1) src/elixir_compiler.erl:38: :elixir_compiler.maybe_fast_compile/2
  (elixir 1.17.1) src/elixir_lexical.erl:15: :elixir_lexical.run/3

Generated stellar app
Dependency ash_postgres is already in mix.exs. Should we replace it?

Desired: `{:ash_postgres, "~> 2.0"}`
Found: `{:ash_postgres, [github: "ash-project/ash_postgres", override: true]}`
 [Yn] n

The following installer was found and executed: `ash_postgres.install`:

    No proposed content changes!

The following tasks will be run

* ash.codegen initialize

Proceed with changes? [Yn] n

For now, I’ve manually added ash-functions into the repo. Is the intended default behavior to omit ash-functions?

P.S: also skips out on min_pg_version

zachdaniel

zachdaniel

Creator of Ash

Oops, thanks :slight_smile: fixed in v2.2.3

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews