I’m trying to make a simple listing query for a schema looking like this:
defmodule BasicChannel do
use Chat.web, :model
schema "basic_channels" do
belongs_to :family, Family, [primary_key: true]
belongs_to :user, User, [primary_key: true]
belongs_to :group_channel, Chat.GroupChannel
end
end
But when I try to load all BasicChannels Ecto fails complaining about ‘id’ missing.
Repo.all(Chat.BasicChannel)
[debug] QUERY ERROR source="basic_channels" db=1.2ms
SELECT s0."id", s0."family_id", s0."user_id", s0."group_channel_id" FROM "basic_channels" AS s0 []
** (Postgrex.Error) ERROR 42703 (undefined_column): column s0.id does not exist
How can I tell Ecto that I don’t have a id field, and that the primary key is the group key (family_id, user_id)?