rails/rails — Issue #3934: add_column migration doesn't support :index - use add_index instead (SQLite3)?
Author: bsodmike
Created: 2011-12-11 07:59:01+00:00
State: open

Hi all-

I just ran into the following:

```bash
add_column(:post_taggings, :post_id, :index)
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: near "index": syntax error: ALTER TABLE "post_taggings" ADD "post_id" index
```

and

```bash
Migrating to AddIndexesToPostTagging (20111211074623)
(0.2ms) ALTER TABLE "post_taggings" ADD "post_id" index
SQLite3::SQLException: near "index": syntax error: ALTER TABLE "post_taggings" ADD "post_id" index
(0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
```

Using `add_index` worked like a charm — this is with Rails 3.1.3 and Ruby 1.9.2-p290