diff options
Diffstat (limited to 'db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb')
-rw-r--r-- | db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb b/db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb new file mode 100644 index 00000000000..76cb511424e --- /dev/null +++ b/db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb @@ -0,0 +1,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 |