Skip to content

Add less-strict index for alert fingerprints

Sean Arnold requested to merge 223151-adjust-unique-index-on-alerts into master

What does this MR do?

This is part of #223151 (closed).

This changes the fingerprint uniqueness index to only enforce if the status is not resolved (value of 2).

rake db:migrate:up VERSION=20200706035141
rake db:migrate:up VERSION=20200706035141
== 20200706035141 AdjustUniqueIndexAlertManagementAlerts: migrating ===========
-- remove_index(:alert_management_alerts, {:name=>"index_alert_management_alerts_on_project_id_and_fingerprint"})
   -> 0.0008s
-- add_index(:alert_management_alerts, ["project_id", "fingerprint"], {:where=>"status <> '2'", :name=>"index_alert_management_alerts_on_project_id_and_fingerprint", :unique=>true, :using=>:btree})
   -> 0.0095s
== 20200706035141 AdjustUniqueIndexAlertManagementAlerts: migrated (0.0105s) ==
rake db:migrate:down VERSION=20200706035141
rake db:migrate:down VERSION=20200706035141
== 20200706035141 AdjustUniqueIndexAlertManagementAlerts: reverting ===========
-- remove_index(:alert_management_alerts, {:name=>"index_alert_management_alerts_on_project_id_and_fingerprint"})
   -> 0.0011s
-- add_index(:alert_management_alerts, ["project_id", "fingerprint"], {:name=>"index_alert_management_alerts_on_project_id_and_fingerprint", :unique=>true, :using=>:btree})
   -> 0.0106s
== 20200706035141 AdjustUniqueIndexAlertManagementAlerts: reverted (0.0118s) ==

Does this MR meet the acceptance criteria?

Conformity

Edited by Sean Arnold

Merge request reports

Loading