How to Disable Ecto in Elixir Phoenix After Project Creation

Jian Jye
1 min readMar 8, 2021

--

Photo by Giammarco Boscaro on Unsplash

If you have created an Elixir Phoenix project without the --no-ecto flag, you will see a lot of warnings and errors regarding databases and ecto down the line.

Here’s how you can disable it.

Go to lib/myapp/application.ex, comment out the following lines:

children = [
# Start the Ecto repository
# Myapp.Repo,
...
]

Then look for config/dev.exs and comment out the following lines:

# Configure your database
# config :myapp, Myapp.Repo,
# username: "",
# password: "",
# database: "myapp_dev",
# hostname: "localhost",
# show_sensitive_data_on_connection_error: true,
# pool_size: 10

And to disable for production deployment, go to config/prod.secret.exs, comment out the following lines:

# database_url =
# System.get_env("DATABASE_URL") ||
# raise """
# environment variable DATABASE_URL is missing.
# For example: ecto://USER:PASS@HOST/DATABASE
# """
# config :krypto, Krypto.Repo,
# # ssl: true,
# url: database_url,
# pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")

That’s all! The errors should stop appearing.

And if you need to re-enable Ecto again, just uncomment all these lines!

--

--

Jian Jye

I write about Laravel, PHP, and web development related articles.