Commit 86491e65 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'fix_label_migration' into 'master'

Fix label migration

Failure to create any labels at all caused this DB migration to run for over 40
minutes during a gitlab.com deploy this morning. This change specifies a color f
or each new label and strips invalid characters from the label name.

See merge request !1024
parents 0b3ebb64 dfc5bf6b
......@@ -15,10 +15,10 @@ class MigrateTaggableLabels < ActiveRecord::Migration
def create_label_from_tagging(tagging)
target = tagging.taggable
label_name = tagging.tag.name
label = target.project.labels.find_or_create_by(title: label_name)
label_name = tagging.tag.name.tr('?&,', '')
label = target.project.labels.find_or_create_by(title: label_name, color: Label::DEFAULT_COLOR)
if LabelLink.create(label: label, target: target)
if label.valid? && LabelLink.create(label: label, target: target)
print '.'
else
print 'F'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment