Add index to notification settings
This commit is contained in:
parent
ca3c5c295e
commit
8450fe3074
4 changed files with 22 additions and 1 deletions
|
@ -34,6 +34,7 @@ v 8.9.0 (unreleased)
|
|||
- Cache project build count in sidebar nav
|
||||
- Reduce number of queries needed to render issue labels in the sidebar
|
||||
- Improve error handling importing projects
|
||||
- Remove duplicated notification settings
|
||||
- Put project Files and Commits tabs under Code tab
|
||||
|
||||
v 8.8.4
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
DELETE FROM notification_settings WHERE id NOT IN ( SELECT min_id from (SELECT MIN(id) as min_id FROM notification_settings GROUP BY user_id, source_type, source_id) as dups )
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddIndexToNotificationSettings < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_concurrent_index :notification_settings, [:user_id, :source_id, :source_type], { unique: true, name: "index_notifications_on_user_id_and_source_id_and_source_type" }
|
||||
end
|
||||
end
|
|
@ -19,7 +19,11 @@ module Gitlab
|
|||
end
|
||||
|
||||
if Database.postgresql?
|
||||
args << { algorithm: :concurrently }
|
||||
if args[2].present?
|
||||
args[2].merge!({ algorithm: :concurrently })
|
||||
else
|
||||
args << { algorithm: :concurrently }
|
||||
end
|
||||
end
|
||||
|
||||
add_index(*args)
|
||||
|
|
Loading…
Reference in a new issue