I'm following this tutorial which adds a postgrex extension into the config.exs
with the extensions
field. However that is now a deprecated way to add a postgrex extension, we should now use the type
field instead of the extensions
field. I'm following the code on the geo library github page, to add the extension:
config.exs
Postgrex.Types.define(MyApp.PostgresTypes,
[Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(),
json: Poison)
use Mix.Config
config :api, Api.Repo,
types: MyApp.PostgresTypes,
adapter: Ecto.Adapters.Postgres,
database: "api_repo",
username: "postgres",
password: "postgres",
hostname: "localhost",
web_port: String.to_integer(System.get_env("PORT") || "4000"),
timeout: 60_000,
pool_timeout: 60_000
config :api, ecto_repos: [Api.Repo]
But I'm getting this error:
bash-3.2$ mix ecto.migrate
** (Mix.Config.LoadError) could not load config config/config.exs
** (UndefinedFunctionError) function Ecto.Adapters.Postgres.extensions/0 is undefined (module Ecto.Adapt
ers.Postgres is not available)
Ecto.Adapters.Postgres.extensions()
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(stdlib) erl_eval.erl:470: :erl_eval.expr/5
(stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:404: :erl_eval.expr/5
(stdlib) erl_eval.erl:122: :erl_eval.exprs/5
I have seen online this is sometimes due to a version of postgrex however that is a very old version and I'm using {:postgrex, "~> 0.13.2"},
. What am I missing?