title: add_index to Data Model - Ruby on Rails Tutorial
body: <p>I am just a bit stuck on this code found in the Ruby on Rails Tutorial.org. What exactly does the <strong>add_index</strong> part of it do? Why are there 3 lines for this?</p>
  
  <pre><code>    class CreateRelationships &lt; ActiveRecord::Migration
    def change
      create_table :relationships do |t|
        t.integer :follower_id
        t.integer :followed_id
  
        t.timestamps
      end
  
      add_index :relationships, :follower_id
      add_index :relationships, :followed_id
      add_index :relationships, [:follower_id, :followed_id], unique: true
    end
  end
  </code></pre>