Hi,
I'm evaluating if korma would be useful in a hobby project, let's consider I have following structure:
users
-----
id bigint
users_contacts
--------------
user_id bigint
contact_id bigint
active boolean
I would like to join only active contacts with korma, I (intuitively) tried something like following:
(defentity contacts
(table :users))
(defentity users
(many-to-many contacts :users_contacts
{:lfk :user_id
:rfk :contact_id
:where {:verified true}}))
However this doesn't seem to work, how could I add a where clause to the many-to-many relation so that only verified relations would be selected. Is this possible with many-to-many by korma? Are there any workarounds? The verified flag above might not be the best example, but in this case I really would like to add some metadata to a many-to-many relation.
Otherwise korma seems very nice, but I wouldn't want to design my database schema purely by the limitations of it. So hope there's a good solution.
Juho