mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 21:15:46 +08:00
PERF: add an index on slug to make sure that slug lookups are quick
This commit is contained in:
parent
bcbee91f0c
commit
237968b1b7
9
db/migrate/20170824172615_add_slug_index_on_topic.rb
Normal file
9
db/migrate/20170824172615_add_slug_index_on_topic.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user