add_indexの追加
フォロー機能を追加したいため
add_indexを追加する
rails g migration AddIndexToRelationships
class AddIndexToRelationships < ActiveRecord::Migration[5.1]
def change
end
class AddIndexToRelationships < ActiveRecord::Migration[5.1]
def change
add_index :relationships, :follower_id
add_index :relationships, :followed_id
add_index :relationships, [:follower_id, :followed_id], unique: true 追加
end
rake db:migrate