title: SQLite3::SQLException: near "CONSTRAINT": syntax error
body: <p>Can you help me with this problem. First I create a migration that generates three tables. Then I try execute a sql query but for some reason an error is triggered
  I am a newbie. I am reading Rails Guides in it version four (4.0.6 Ruby On Rails)</p>
  
  <pre><code>class ExampleMigration &lt; ActiveRecord::Migration
        def up
          create_table :categories do |t|
  
          end
  
  
          create_table :users do |t|
            t.string :email
          end
  
  
          create_table :products do |t|
            t.references :category
          end
  
          execute &lt;&lt;-SQL
            ALTER TABLE products
              ADD CONSTRAINT fk_products_categories
              FOREIGN KEY (category_id)
              REFERENCES categories(id)
          SQL
  
  
  
  
          add_column :users, :home_page_url, :string
          rename_column :users, :email, :email_address
        end
  
        def down
          # add a foreign key
          execute &lt;&lt;-SQL
            ALTER TABLE products
              DROP FOREIGN KEY fk_products_categories
          SQL
  
          rename_column :users, :email_address, :email
          remove_column :users, :home_page_url
  
          drop_table :products
          drop_table :users
          drop_table :products
        end
  </code></pre>
  
  <p>Ubuntu Console</p>
  
  <pre><code>trabajo@fernando:~/estudio/MigrationsGuides$ rake db:drop
  trabajo@fernando:~/estudio/MigrationsGuides$ rake db:migrate
  ==  ExampleMigration: migrating ===============================================
  -- create_table(:categories)
     -&gt; 0.0019s
  -- create_table(:users)
     -&gt; 0.0012s
  -- create_table(:products)
     -&gt; 0.0007s
  -- execute("      ALTER TABLE products\n        ADD CONSTRAINT fk_products_categories\n        FOREIGN KEY (category_id)\n        REFERENCES categories(id)\n")
  rake aborted!
  StandardError: An error has occurred, this and all later migrations canceled:
  
  SQLite3::SQLException: near "CONSTRAINT": syntax error:       ALTER TABLE products
          ADD CONSTRAINT fk_products_categories
          FOREIGN KEY (category_id)
          REFERENCES categories(id)
  /home/trabajo/.rvm/gems/ruby-2.0.0-p481@MigracionesGuides/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `initialize'
  /home/trabajo/.rvm/gems/ruby-2.0.0-p481@MigracionesGuides/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `new'
  /home/trabajo/.rvm/gems/ruby-2.0.0-p481@MigracionesGuides/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `prepare'
  /home/trabajo/.rvm/gems/ruby-2.0.0-p481@MigracionesGuides/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:134:in `execute'
  </code></pre>