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

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

class EnsureNoEmptyMilestoneTitles < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def up
    loop do
      rows_updated = exec_update <<~SQL
        UPDATE milestones SET title = '%BLANK' WHERE id IN (SELECT id FROM milestones WHERE title = '' LIMIT 500)
      SQL
      break if rows_updated < 500
    end
  end

  def down; end
end