@@ -344,42 +344,50 @@ defmodule AshPostgres.Repo do
344344 create?: 0 ,
345345 drop?: 0
346346
347- def __after_compile__ ( _ , _ ) do
348- if "ash-functions" in installed_extensions ( ) || ! @ warn_on_missing_ash_functions do
349- :ok
350- else
351- IO . warn ( """
352- AshPostgres: You have not installed the `ash-functions` extension.
347+ # We do this switch because `!@warn_on_missing_ash_functions` in the function body triggers
348+ # a dialyzer error
349+ if @ warn_on_missing_ash_functions do
350+ def __after_compile__ ( _ , _ ) do
351+ if "ash-functions" in installed_extensions ( ) do
352+ :ok
353+ else
354+ IO . warn ( """
355+ AshPostgres: You have not installed the `ash-functions` extension.
353356
354- The following features will not be available:
357+ The following features will not be available:
355358
356- - atomics (using the `raise_ash_error` function)
357- - `string_trim` (using the `ash_trim_whitespace` function)
358- - the `||` and `&&` operators (using the `ash_elixir_and` and `ash_elixir_or` functions)
359+ - atomics (using the `raise_ash_error` function)
360+ - `string_trim` (using the `ash_trim_whitespace` function)
361+ - the `||` and `&&` operators (using the `ash_elixir_and` and `ash_elixir_or` functions)
359362
360- To address this warning, do one of two things:
363+ To address this warning, do one of two things:
361364
362- 1. add the `"ash-functions"` extension to your `installed_extensions/0` function, and then generate migrations.
365+ 1. add the `"ash-functions"` extension to your `installed_extensions/0` function, and then generate migrations.
363366
364- def installed_extensions do
365- ["ash-functions"]
366- end
367+ def installed_extensions do
368+ ["ash-functions"]
369+ end
367370
368- If you are *not* using the migration generator, but would like to leverage these features, follow the above instructions,
369- and then visit the source for `ash_postgres` and copy the latest version of those functions into your own migrations:
371+ If you are *not* using the migration generator, but would like to leverage these features, follow the above instructions,
372+ and then visit the source for `ash_postgres` and copy the latest version of those functions into your own migrations:
370373
371- 2. disable this warning, by adding the following to your `use` statement:
374+ 2. disable this warning, by adding the following to your `use` statement:
372375
373- use AshPostgres.Repo,
374- ..
375- warn_on_missing_ash_functions?: false
376+ use AshPostgres.Repo,
377+ ..
378+ warn_on_missing_ash_functions?: false
376379
377- Keep in mind that if you disable this warning, you will not be able to use the features mentioned above.
378- If you are in an environment where you cannot define functions, you will have to use the second option.
380+ Keep in mind that if you disable this warning, you will not be able to use the features mentioned above.
381+ If you are in an environment where you cannot define functions, you will have to use the second option.
379382
380383
381- https://github.com/ash-project/ash_postgres/blob/main/lib/migration_generator/ash_functions.ex
382- """ )
384+ https://github.com/ash-project/ash_postgres/blob/main/lib/migration_generator/ash_functions.ex
385+ """ )
386+ end
387+ end
388+ else
389+ def __after_compile__ ( _ , _ ) do
390+ :ok
383391 end
384392 end
385393 end
0 commit comments