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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJob van der Voort <jobvandervoort@gmail.com>2015-04-21 17:21:51 +0300
committerJob van der Voort <jobvandervoort@gmail.com>2015-04-21 17:21:51 +0300
commita8e93b7f51d968c1380ed210499869b62b07fd15 (patch)
treec864e80dfd9cf4f83fcede678acc986e3a125bf5 /db/migrate/20140729152420_migrate_taggable_labels.rb
parent0625b15a481b3a3edd88110b3c18031ad9068d2f (diff)
Version 7.10.0.rc5v7.10.0.rc5
Diffstat (limited to 'db/migrate/20140729152420_migrate_taggable_labels.rb')
-rw-r--r--db/migrate/20140729152420_migrate_taggable_labels.rb35
1 files changed, 0 insertions, 35 deletions
diff --git a/db/migrate/20140729152420_migrate_taggable_labels.rb b/db/migrate/20140729152420_migrate_taggable_labels.rb
deleted file mode 100644
index dc28d727d9a..00000000000
--- a/db/migrate/20140729152420_migrate_taggable_labels.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-class MigrateTaggableLabels < ActiveRecord::Migration
- def up
- taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
- taggings.find_each(batch_size: 500) do |tagging|
- # Clean up orphaned taggings while we are here
- if tagging.taggable.blank? || tagging.tag.nil?
- tagging.destroy
- print 'D'
- next
- end
- create_label_from_tagging(tagging)
- end
- end
-
- def down
- Label.destroy_all
- LabelLink.destroy_all
- end
-
- private
-
- def create_label_from_tagging(tagging)
- target = tagging.taggable
- label_name = tagging.tag.name
- # '?', '&' and ',' are no longer allowed in label names so we remove them
- label_name.tr!('?&,', '')
- label = target.project.labels.find_or_create_by(title: label_name, color: Label::DEFAULT_COLOR)
-
- if label.valid? && LabelLink.create(label: label, target: target)
- print '.'
- else
- print 'F'
- end
- end
-end