class CreateJoinTableTeamUser < ActiveRecord::Migration[5.0]
def change
create_join_table :teams, :users do |t|
t.index [:team_id, :user_id]
t.index [:user_id, :team_id]
end
end
end
class CreateTeamUser < ActiveRecord::Migration[5.0]
def change
create_table :team_users do |t|
t.integer team_id
t.integer user_id
end
end
end
rails g migration CreateTeamUsers team_id:integer user_id:integer