I have the tables users, communities and community_user
community id ... (other columns) user id ... (other columns) community_user id community_id user_id role
I want to create relationships so an user can belong to many communities and have a different role on each one (admin, member, etc).
How should I define my models? Can a many-to-many relationship have a key?