Lightweight runtime db management utility for Elixir/Ecto Releases.
Designed to be invoked via eval on release binaries in production/staging environments
where Mix is not installed.
Summary
Functions
Creates all databases associated with the application's Ecto repos.
Drops all databases associated with the application's Ecto repos.
Runs the database seed script.
Functions
@spec create(atom()) :: :ok
Creates all databases associated with the application's Ecto repos.
Examples
# In release execution:
# ./bin/my_app eval "DbOps.create(:my_app)"
Drops all databases associated with the application's Ecto repos.
Requires explicit confirmation parameter to prevent accidental deletion in production.
Examples
# Refused execution:
# ./bin/my_app eval "DbOps.drop(:my_app)"
# Confirmed execution:
# ./bin/my_app eval "DbOps.drop(:my_app, confirm: "YES_DELETE_DATABASE")"
Runs the database seed script.
Defaults to priv/repo/seeds.exs inside the application's priv directory.
Examples
# ./bin/my_app eval "DbOps.seed(:my_app)"
# ./bin/my_app eval "DbOps.seed(:my_app, "priv/repo/custom_seeds.exs")"