Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ah, bummer. Anyone have any luck getting partial indexes to work in Rails 3.2?


You can always execute arbitrary SQL in migrations. For instance:

    def up
      execute('ALTER TABLE people ADD INDEX ...')
    end
The one thing to keep in mind though is that if you use ruby schema format, your tests won't pick up those execute statements. In that case it's best to either use the sql format or re-run migrations in the test environment to set up the test db.


Upgrading from Rails 3.2 to Rails 4.0 takes very little time, assuming the gems you depend on are compatible (which they should be, by now, or you might want to look for replacement gems..)


You could just do it manually:

    execute %{
      create index index_users_on_name
      on users (name)
      where state = 'NY';
    }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: