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

20231126220000_cleanup_container_registry_protection_rules_container_path_pattern_at_rename.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e3f8c53199a5705b50153fcbceccf3732a2096c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

class CleanupContainerRegistryProtectionRulesContainerPathPatternAtRename < Gitlab::Database::Migration[2.2]
  milestone '16.7'

  disable_ddl_transaction!

  def up
    cleanup_concurrent_column_rename :container_registry_protection_rules, :container_path_pattern,
      :repository_path_pattern
  end

  def down
    undo_cleanup_concurrent_column_rename :container_registry_protection_rules, :container_path_pattern,
      :repository_path_pattern

    # Restoring the old index name `:i_container_protection_unique_project_id_container_path_pattern`
    # that was changed in the following migrations:
    # - `db/migrate/20231126200903_rename_container_registry_protection_rules_container_path_pattern.rb`
    # - `db/migrate/20231126200904_rename_index_i_container_protection_unique_project_id_container_path_pattern.rb`
    if index_exists?(:container_registry_protection_rules, [:project_id, :container_path_pattern],
      name: :i_container_protection_unique_project_container_path_pattern)
      rename_index :container_registry_protection_rules, :i_container_protection_unique_project_container_path_pattern,
        :i_container_protection_unique_project_id_container_path_pattern
    end
  end
end