Move SQLite extension loading to config/runtime.exs

Addresses deprecation mentioned at https://hexdocs.pm/ecto/Ecto.Repo.html#c:init/2
This commit is contained in:
Claudio Ortolina
2024-12-07 20:29:33 +01:00
parent 11ebd0b6de
commit 1c47473c11
3 changed files with 5 additions and 8 deletions
+5
View File
@@ -28,6 +28,11 @@ if user = System.get_env("LAST_FM_USER") do
config :music_library, LastFm, user: user
end
config :music_library, MusicLibrary.Repo,
load_extensions: [
MusicLibrary.Repo.extension_path("unicode")
]
if config_env() == :prod do
database_path =
System.get_env("DATABASE_PATH") ||
-7
View File
@@ -3,13 +3,6 @@ defmodule MusicLibrary.Repo do
otp_app: :music_library,
adapter: Ecto.Adapters.SQLite3
def init(_context, config) do
{:ok,
Keyword.put(config, :load_extensions, [
extension_path("unicode")
])}
end
def extension_path(name) do
[arch | _rest] =
:erlang.system_info(:system_architecture)
-1
View File
@@ -1,5 +1,4 @@
defmodule MusicLibrary.RepoTest do
alias MusicLibrary.ReleaseGroupsFixtures
use MusicLibrary.DataCase
describe "correctly loads the unicode extension" do