I had to say that the intention is to let you choose a strategy that suits you. This is usually a solution with two criteria
- how much overhead indexes adds
- how do you request your db
Therefore, they cannot make this decision for you and add indexing overhead as an agreement.
To make this decision, you need to know how you are going to query your database. In MySQL, composite indexes can be useful for a set of queries. multi-column pointer
The index on column_a, column_b, column_c will be used for queries on
- all three fields together
column_acolumn_a and column_b together
So there is a difference between
t.index [:team_id, :user_id]
and
t.index [:user_id, :team_id]
the actual complete set of indexes you will need
t.index [:team_id, :user_id] t.index :user_id
or
t.index [:user_id, :team_id] t.index :team_id
To handle all three cases with an index.
Example
if you find that your application uses queries such as
user.teams that translate to
select * from teams where user_id = X
index user_id (or user_id, team_id ) can be convenient
therefore t.index [:user_id, :team_id] should be your choice