canvas-lms/db/migrate/20111223215543_index_calend...

16 lines
514 B
Ruby

class IndexCalendarEventsEffectiveContextCode < ActiveRecord::Migration
tag :predeploy
def self.up
if connection.adapter_name == 'PostgreSQL'
connection.execute("CREATE INDEX index_calendar_events_on_effective_context_code ON #{CalendarEvent.quoted_table_name}(effective_context_code) WHERE effective_context_code IS NOT NULL")
else
add_index :calendar_events, [:effective_context_code]
end
end
def self.down
remove_index :calendar_events, [:effective_context_code]
end
end