Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210621044000_rename_services_indexes_to_integrations.rb')
-rw-r--r--db/migrate/20210621044000_rename_services_indexes_to_integrations.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/db/migrate/20210621044000_rename_services_indexes_to_integrations.rb b/db/migrate/20210621044000_rename_services_indexes_to_integrations.rb
new file mode 100644
index 00000000000..9dba663f6a7
--- /dev/null
+++ b/db/migrate/20210621044000_rename_services_indexes_to_integrations.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RenameServicesIndexesToIntegrations < ActiveRecord::Migration[6.1]
+ INDEXES = %w(
+ project_and_type_where_inherit_null
+ project_id_and_type_unique
+ template
+ type
+ type_and_instance_partial
+ type_and_template_partial
+ type_id_when_active_and_project_id_not_null
+ unique_group_id_and_type
+ ).freeze
+
+ def up
+ INDEXES.each do |index|
+ execute(<<~SQL)
+ ALTER INDEX IF EXISTS "index_services_on_#{index}" RENAME TO "index_integrations_on_#{index}"
+ SQL
+ end
+ end
+
+ def down
+ INDEXES.each do |index|
+ execute(<<~SQL)
+ ALTER INDEX IF EXISTS "index_integrations_on_#{index}" RENAME TO "index_services_on_#{index}"
+ SQL
+ end
+ end
+end