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
path: root/db
diff options
context:
space:
mode:
authorJames Brooks <jbrooksuk@me.com>2014-08-28 00:08:40 +0400
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-08-28 17:07:16 +0400
commitdc42aae3b2e07505ff843ec94150fdb69867adab (patch)
treeecf2623e70d8680600445e60471c2a0a86eb2356 /db
parenta044c4b14a2a4e73e694ec3f002a160d0991932f (diff)
Fixes #7571
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140729152420_migrate_taggable_labels.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/db/migrate/20140729152420_migrate_taggable_labels.rb b/db/migrate/20140729152420_migrate_taggable_labels.rb
index f164015506d..dc28d727d9a 100644
--- a/db/migrate/20140729152420_migrate_taggable_labels.rb
+++ b/db/migrate/20140729152420_migrate_taggable_labels.rb
@@ -2,6 +2,12 @@ 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