mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 10:15:37 +08:00
PERF: Add index to notifications to speed up moving of posts
This commit is contained in:
parent
92213813d4
commit
6a0e232dea
15
db/migrate/20191030112559_add_index_to_notifications.rb
Normal file
15
db/migrate/20191030112559_add_index_to_notifications.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddIndexToNotifications < ActiveRecord::Migration[6.0]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def up
|
||||||
|
if !index_exists?(:notifications, [:topic_id, :post_number])
|
||||||
|
add_index :notifications, [:topic_id, :post_number], algorithm: :concurrently
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user