Commit 46484c6d authored by Sean Arnold's avatar Sean Arnold

Add concurrent indexes

- Remove unnecessary cast
parent 77197d68
...@@ -8,11 +8,11 @@ class AdjustUniqueIndexAlertManagementAlerts < ActiveRecord::Migration[6.0] ...@@ -8,11 +8,11 @@ class AdjustUniqueIndexAlertManagementAlerts < ActiveRecord::Migration[6.0]
NEW_INDEX_NAME = 'index_partial_am_alerts_on_project_id_and_fingerprint' NEW_INDEX_NAME = 'index_partial_am_alerts_on_project_id_and_fingerprint'
RESOLVED_STATUS = 2 RESOLVED_STATUS = 2
# rubocop:disable Migration/RemoveIndex disable_ddl_transaction!
# rubocop:disable Migration/AddIndex
def up def up
add_index(:alert_management_alerts, %w(project_id fingerprint), where: "status <> '#{RESOLVED_STATUS}'", name: NEW_INDEX_NAME, unique: true, using: :btree) add_concurrent_index(:alert_management_alerts, %w(project_id fingerprint), where: "status <> #{RESOLVED_STATUS}", name: NEW_INDEX_NAME, unique: true, using: :btree)
remove_index :alert_management_alerts, name: INDEX_NAME remove_concurrent_index_by_name :alert_management_alerts, INDEX_NAME
end end
def down def down
...@@ -29,9 +29,7 @@ class AdjustUniqueIndexAlertManagementAlerts < ActiveRecord::Migration[6.0] ...@@ -29,9 +29,7 @@ class AdjustUniqueIndexAlertManagementAlerts < ActiveRecord::Migration[6.0]
execute(query) execute(query)
remove_index :alert_management_alerts, name: NEW_INDEX_NAME remove_concurrent_index_by_name :alert_management_alerts, NEW_INDEX_NAME
add_index(:alert_management_alerts, %w(project_id fingerprint), name: INDEX_NAME, unique: true, using: :btree) add_concurrent_index(:alert_management_alerts, %w(project_id fingerprint), name: INDEX_NAME, unique: true, using: :btree)
end end
# rubocop:enable Migration/RemoveIndex
# rubocop:enable Migration/AddIndex
end end
...@@ -19943,7 +19943,7 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON public.page ...@@ -19943,7 +19943,7 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON public.page
CREATE INDEX index_pages_domains_on_wildcard ON public.pages_domains USING btree (wildcard); CREATE INDEX index_pages_domains_on_wildcard ON public.pages_domains USING btree (wildcard);
CREATE UNIQUE INDEX index_partial_am_alerts_on_project_id_and_fingerprint ON public.alert_management_alerts USING btree (project_id, fingerprint) WHERE (status <> '2'::smallint); CREATE UNIQUE INDEX index_partial_am_alerts_on_project_id_and_fingerprint ON public.alert_management_alerts USING btree (project_id, fingerprint) WHERE (status <> 2);
CREATE UNIQUE INDEX index_partitioned_foreign_keys_unique_index ON public.partitioned_foreign_keys USING btree (to_table, from_table, from_column); CREATE UNIQUE INDEX index_partitioned_foreign_keys_unique_index ON public.partitioned_foreign_keys USING btree (to_table, from_table, from_column);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment