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

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

class RemoveVulnerabilityOccurrencesMigratedToNewStructureColumn < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_vulnerability_occurrences_on_migrated_to_new_structure'

  def up
    with_lock_retries do
      remove_column :vulnerability_occurrences, :migrated_to_new_structure
    end
  end

  def down
    unless column_exists?(:vulnerability_occurrences, :migrated_to_new_structure)
      add_column :vulnerability_occurrences, :migrated_to_new_structure, :boolean, default: false, null: false
    end

    add_concurrent_index :vulnerability_occurrences, [:migrated_to_new_structure, :id], name: INDEX_NAME
  end
end