PERF: add an index on slug to make sure that slug lookups are quick

This commit is contained in:
Sam 2017-08-24 13:33:25 -04:00
parent bcbee91f0c
commit 237968b1b7
1 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,9 @@
class AddSlugIndexOnTopic < ActiveRecord::Migration
def up
execute 'CREATE INDEX idxTopicSlug ON topics(slug) WHERE deleted_at IS NULL AND slug IS NOT NULL'
end
def down
execute 'DROP INDEX idxTopicSlug'
end
end