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

20200219193058_remove_state_from_issues.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 007ba600ce75ac88cbe6d7abfd89c3e11ef2547e (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
28
29
30
# frozen_string_literal: true

class RemoveStateFromIssues < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    return unless issue_state_column_exists?

    # Ignored in 12.6 - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/19574
    with_lock_retries do
      remove_column :issues, :state, :string
    end
  end

  def down
    return if issue_state_column_exists?

    with_lock_retries do
      add_column :issues, :state, :string
    end
  end

  private

  def issue_state_column_exists?
    column_exists?(:issues, :state)
  end
end