Model count query does not work without implicit `id` field
FrancisMurillo opened this issue · 2 comments
Hello,
I noticed when I try to get a .rummage
, a count query executes such as SELECT count(t0.id) FROM table AS t0
. My issue is that I don't have an implicit id
field in my models, rather a prefixed table id name such as table.table_id
instead of table.id
.
I noticed in the function get_total_count
, the query, count(b.id)
, confirms this. It could have been any key which could have been inferred by Schema.__schema__(:fields) |> List.first()
. (https://hexdocs.pm/ecto/Ecto.Schema.html#module-reflection)
Although this may not be fixed, the documentation should include that implicit field or have it configurable. For the meantime, I added the implicit blank id
field as a workaround.
Good catch, @FrancisMurillo. Thanks for letting me know! I will get the fix in asap 🔨 🔧
Addressed and fixed in #56