Ecto プロジェクトでこの問題が発生しています。どのクエリも機能していません。私はグーグルとgithubの問題を少し検索しました。いくつかありますが、私の問題とは関係ありません。
この質問は、この質問から開始されましたhttps://github.com/elixir-lang/ecto/issues/602#issuecomment-145596702 (主に私の問題に関連しています)
query = from u in Univer, where: u.id > 4, select: u
で爆破** (RuntimeError) undefined function: u/0
。そのモデルだけでなく、他のモデルも同様です。私の担当者。
{:postgrex, "~> 0.9.1"},
{:poison, "~> 1.5"},
{:httpoison, "~> 0.7.2"},
{:ecto, "~> 1.0.4"},
{:floki, "~> 0.5"}
現在、db からの読み取りはすべて 経由で行われてpsql
います。それは仕事をしますが、面倒です。:)
参考までに。
defmodule Univer do
use Ecto.Model
import Ecto.Query
schema "univers" do
field :ref, :integer
field :name, :string
field :legal_name, :string
field :city, :string
field :type, :string
field :address, :string
field :contacts, {:array, :string}
field :fax, :string
field :phones, {:array, :string}
field :email, :string
field :url, :string
has_many :schools, School
has_one :place, Place
timestamps
end
end
そして移住
defmodule Univer.Repo.Migrations.AddUniversTable do
use Ecto.Migration
def up do
create table(:univers) do
add :ref, :integer
add :name, :text
add :legal_name, :text
add :type, :string
add :fax, :string
add :city, :string
add :contacts, {:array, :string}
add :address, :text
add :phones, {:array, :string}
add :email, :string
add :url, :string
timestamps
end
end
def down do
drop table(:univers)
end
end