From dc42aae3b2e07505ff843ec94150fdb69867adab Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 27 Aug 2014 21:08:40 +0100 Subject: Fixes #7571 --- db/migrate/20140729152420_migrate_taggable_labels.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'db') 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 -- cgit v1.2.3