db: add indexes on comment fields.
This commit is contained in:
11
db/migrate/20220923010905_add_indexes_on_comments.rb
Normal file
11
db/migrate/20220923010905_add_indexes_on_comments.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class AddIndexesOnComments < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :comments, :score, if_not_exists: true, algorithm: :concurrently
|
||||
add_index :comments, :is_deleted, where: "is_deleted = true", if_not_exists: true, algorithm: :concurrently
|
||||
add_index :comments, :is_sticky, where: "is_sticky = true", if_not_exists: true, algorithm: :concurrently
|
||||
add_index :comments, :do_not_bump_post, where: "do_not_bump_post = true", if_not_exists: true, algorithm: :concurrently
|
||||
add_index :comments, :updater_id, where: "updater_id IS NOT NULL", if_not_exists: true, algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user