canvas-lms/db/migrate/20111228210808_add_indexes_...

18 lines
551 B
Ruby

class AddIndexesToPseudonyms < ActiveRecord::Migration
def self.up
if connection.adapter_name == 'PostgreSQL'
remove_index :pseudonyms, :unique_id
connection.execute("CREATE INDEX index_pseudonyms_on_unique_id ON pseudonyms (LOWER(unique_id))")
end
add_index :pseudonyms, :sis_user_id
end
def self.down
remove_index :pseudonyms, :sis_user_id
if connection.adapter_name == 'PostgreSQL'
connection.execute("DROP INDEX index_pseudonyms_on_unique_id")
add_index :pseudonyms, :unique_id
end
end
end