I have a data model that looks like this:
%Game{
id,
team_id,
date,
...
}
%WellnessEvaluation{
id,
athlete_id,
team_id,
date,
...
}
Is it possible to use Ecto’s has_many
(or many_to_many
) relationship between Game and WellnessEvaluation joining on date
and team_id
columns? The result would be a game on 2019-05-29
with a team_id of 1
would be able to get a list of Wellness Evaluations that have the corresponding date and team_id.
The convenience of being able to reference the Wellness Evaluations through a Game is appealing to me. As far as I understand these Ecto functions provide only the the ability to join on one column or through a join table which I don’t think would be necessary in this case.