Some of my older clients use mssql while the new ones use postgres.
Before each release generation I change repo.ex to use the required adapter.
So I create two releases, one for the clients using postgres and another for the clients using mssql.
Is it possible to configure the adapter in runtime.exs?
How about changing the approach to something like this (this is a rough sketch):
defmodule MyApp.PostresRepo do
use Ecto.Repo,
otp_app: :myapp,
adapter: Ecto.Adapters.Postgres
end
defmodule MyApp.MySqlRepo do
use Ecto.Repo,
otp_app: :myapp,
adapter: TheMySqlAdapter
end
MyApp.Repo = Application.get_env(:myapp, :repo)
1 Like