How to Disable Ecto in Elixir Phoenix After Project Creation

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!




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What Is A Stream Position Pointer In Python Handling Of Files

Containers vs VMs

Deploy Laravel application with CI/CD and Envoy

Learn Bootstrap in 5 Minutes

BSC-Centric Oracle Network Berry Data Enters Strategic Collaboration with GetBlock

Why We Switched To A Third Party Visualization Library

Python Context Manager

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jian Jye

Jian Jye

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

More from Medium

Using Ecto changesets for JSON API request body validation.

Listing Modules under a Namespace in Elixir

OPEN API SPEC Elixir/Phoenix

Open API Spec for a home page request

Display localised date / time information from Phoenix LiveView