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

20171207150300_remove_project_labels_group_id_copy.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f339172eeb36aa8d6cc0551ac888a45f8a352e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copy of 20180202111106 - this one should run before 20171207150343 to fix issues related to
# the removal of groups with labels.

class RemoveProjectLabelsGroupIdCopy < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    # rubocop:disable Migration/UpdateColumnInBatches
    update_column_in_batches(:labels, :group_id, nil) do |table, query|
      query.where(table[:type].eq('ProjectLabel').and(table[:group_id].not_eq(nil)))
    end
    # rubocop:enable Migration/UpdateColumnInBatches
  end

  def down
  end
end