blob: d1bbcca0dfc98235e68d478298ea0d8c3c6e197a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
defmodule Silmataivas.Repo do
use Ecto.Repo,
otp_app: :silmataivas,
adapter: Ecto.Adapters.SQLite3
@doc """
Dynamic adapter configuration based on application environment.
This will be automatically called by Ecto during startup.
"""
def init(_type, config) do
# Check for adapter in config, fall back to Ecto.Adapters.SQLite3
adapter =
config[:adapter] ||
Application.get_env(:silmataivas, Silmataivas.Repo, [])[:adapter] ||
Ecto.Adapters.SQLite3
{:ok, Keyword.put(config, :adapter, adapter)}
end
end
|