本文介绍了跨数据库Ecto配置失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 config / dev.exs 中:

config :drupex, Drupex.Repo,
  adapter: Ecto.Adapters.Postgres,
  -- username, password, database, hostname, pool_size omitted --

config :drupex, Drupex.DrupalRepo,
  adapter: Ecto.Adapters.Mysql,
  -- username, password, database, hostname omitted --

在 defp deps下的 mix.exs 中我添加了 {:mariaex,〜> 0.8.2},在 {:postgrex,> = 0.0.0} 之后。最后在 lib / drupex / repo.ex 中,我添加了

In mix.exs under defp deps do I added {:mariaex, "~> 0.8.2"}, just after {:postgrex, ">= 0.0.0"}. Finally in lib/drupex/repo.ex I added

defmodule Drupex.DrupalRepo do
  use Ecto.Repo, otp_app: :drupex
end

我运行 mix deps.get , mix deps.compile 现在运行 mix 我得到

I ran mix deps.get , mix deps.compile now running mix I get

** (ArgumentError) adapter Ecto.Adapters.Mysql was not compiled, ensure it is correct and it is included as a project dependency


推荐答案

原来的适配器是称为 MySQL ,它区分大小写。更改为适配器:Ecto.Adapters.MySQL,解决了该问题。

Turns out the adapter is called MySQL and it is case sensitive. Changing to adapter: Ecto.Adapters.MySQL, solved the problem.

这篇关于跨数据库Ecto配置失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:53