【发布时间】:2018-12-22 17:53:07
【问题描述】:
我为没有id 字段的表生成并运行迁移(使用字段league_id 作为主键)。我确认迁移按预期进行(检查了 psql 中的数据库,该表确实没有 id 字段,league_id 是主键)。
当我运行Repo.all(League) 时出现以下错误:
13:01:14.962 [debug] QUERY ERROR source="leagues" db=2.8ms
SELECT l0."id", l0."league_id" FROM "leagues" AS l0 []
** (Postgrex.Error) ERROR 42703 (undefined_column): column l0.id does not exist
有没有办法告诉 Repo.all/1 没有 id 字段(除了手动构建 SELECT * 类型的查询?)
【问题讨论】: