Skip to content

Commit

Permalink
refactor: only define test repo if sqlite3 is available (#67)
Browse files Browse the repository at this point in the history
This keeps the compiler happy if we're in a project or environment in
which the user has chosen not to opt in to sqlite3 usage.
  • Loading branch information
dustinfarris authored and PM-Pepsico committed Aug 27, 2024
1 parent 13f23d6 commit 83d90db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/snowflex/sqlite_test_repo.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
defmodule Snowflex.SQLiteTestRepo do
use Ecto.Repo,
otp_app: :snowflex,
adapter: Ecto.Adapters.SQLite3
if Code.ensure_loaded?(Ecto.Adapters.SQLite3) do
defmodule Snowflex.SQLiteTestRepo do
use Ecto.Repo,
otp_app: :snowflex,
adapter: Ecto.Adapters.SQLite3
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ defmodule Snowflex.MixProject do
{:dialyxir, "~> 1.0", only: :dev, runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:meck, "~> 0.9", only: :test},
{:ecto_sqlite3, "~> 0.8.2", only: [:dev, :test]}
{:ecto_sqlite3, "~> 0.8.2", optional: true, only: [:dev, :test]}
]
end

Expand Down

0 comments on commit 83d90db

Please sign in to comment.