title: Cannot create indexes for PG in rake migration - Rails
body: <p>I am trying to write a migration that will create a table and add a couple of indexes.</p>
  
  <p>This is the migration:</p>
  
  <pre><code>class CreatePages &lt; ActiveRecord::Migration
    def change
      create_table :pages do |t|
          t.string "name", :limit =&gt; 50
          t.string "permalink"
          t.integer "position"
          t.boolean "visible"
          t.integer "subject_id"
  
          add_index("pages","subject_id")
          add_index("pages","name")
  
        t.timestamps
      end
    end
  end
  </code></pre>
  
  <p>When I trying and run this migration I get the following error:</p>
  
  <blockquote>
    <p>PG::Error: ERROR:  relation "pages" does not exist
    : CREATE  INDEX "index_pages_on_subject_id" ON "pages" ("subject_id")</p>
  </blockquote>
  
  <p>Can someone tell me what I'm doing wrong?</p>
  
  <p>Thanks!</p>