Postgres Citext?

Trying to setup Ash Authentication and have gone through the getting started in the docs. Now running into this error when trying to run migrations.
15:12:01.856 [info] create table users
** (Postgrex.Error) ERROR 42704 (undefined_object) type "citext" does not exist
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:913: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:1005: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:326: Ecto.Migration.Runner.log_and_execute_ddl/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:289: Ecto.Migration.Runner.perform_operation/3
15:12:01.856 [info] create table users
** (Postgrex.Error) ERROR 42704 (undefined_object) type "citext" does not exist
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:913: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:1005: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:326: Ecto.Migration.Runner.log_and_execute_ddl/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
(ecto_sql 3.9.2) lib/ecto/migration/runner.ex:289: Ecto.Migration.Runner.perform_operation/3
As far as I can tell I have installed this extension. but the error persists. The user.ex file is unchanged from the docs.
5 Replies
ZachDaniel
ZachDaniel3y ago
How did you install the extension?
lifeling
lifelingOP3y ago
CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION IF NOT EXISTS citext;
when I run that same command again I get the message:
NOTICE: extension "citext" already exists, skipping
NOTICE: extension "citext" already exists, skipping
I realize this is way outside the scope of Ash issues and I should probably be posting this on a Postgres forum, but this didn't rear it's head until I tried Ash Authentication. So I thought I would see if anyone else has had similar issues. I have run ash_postrgres drop, create, and migrate.
ZachDaniel
ZachDaniel3y ago
Well, you can have Ash install the extension for you in your migrations (are you using the migration generator?)
# in your repo
def installed_extensions do
["citext"]
end
# in your repo
def installed_extensions do
["citext"]
end
Then if you delete your snapshots and migrations and regenerate, it should install the extension for you and then migrate
lifeling
lifelingOP3y ago
Awesome, That worked. Thank you!👍🏻
ZachDaniel
ZachDaniel3y ago
My pleasure 🙂

Did you find this page helpful?