[Search 2.0] Add index on articles.comments_count (#13599)
This commit is contained in:
parent
2e9ba2334a
commit
5a1034cab6
2 changed files with 17 additions and 1 deletions
|
|
@ -0,0 +1,15 @@
|
|||
class AddIndexOnArticlesCommentsCount < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
return if index_exists?(:articles, :comments_count)
|
||||
|
||||
add_index :articles, :comments_count, algorithm: :concurrently
|
||||
end
|
||||
|
||||
def down
|
||||
return unless index_exists?(:articles, :comments_count)
|
||||
|
||||
remove_index :articles, column: :comments_count, algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_04_29_094116) do
|
||||
ActiveRecord::Schema.define(version: 2021_04_30_094954) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "citext"
|
||||
|
|
@ -158,6 +158,7 @@ ActiveRecord::Schema.define(version: 2021_04_29_094116) do
|
|||
t.index ["canonical_url"], name: "index_articles_on_canonical_url", unique: true
|
||||
t.index ["collection_id"], name: "index_articles_on_collection_id"
|
||||
t.index ["comment_score"], name: "index_articles_on_comment_score"
|
||||
t.index ["comments_count"], name: "index_articles_on_comments_count"
|
||||
t.index ["featured_number"], name: "index_articles_on_featured_number"
|
||||
t.index ["feed_source_url"], name: "index_articles_on_feed_source_url", unique: true
|
||||
t.index ["hotness_score"], name: "index_articles_on_hotness_score"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue