Skip to content

Instantly share code, notes, and snippets.

@stbenjam
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stbenjam/9518335 to your computer and use it in GitHub Desktop.
Save stbenjam/9518335 to your computer and use it in GitHub Desktop.
class AddIndexToLowerLogin < ActiveRecord::Migration
def up
execute "CREATE INDEX lower_login ON users (LOWER(login))" if ActiveRecord::Base.connection.instance_of? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
end
def down
execute "DROP INDEX lower_login" if ActiveRecord::Base.connection.instance_of? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment