diff options
author | James Brooks <jbrooksuk@me.com> | 2014-08-27 21:08:40 +0100 |
---|---|---|
committer | James Brooks <jbrooksuk@me.com> | 2014-08-27 21:12:37 +0100 |
commit | 63e25c2bb40d8e85897a50c94301511553b4a266 (patch) | |
tree | c0faf41efd91a241401beb5c2afe1b7df28f7177 /db | |
parent | c9054319c8f64e7f91cf062e36434da78979fa76 (diff) | |
download | gitlab-ce-63e25c2bb40d8e85897a50c94301511553b4a266.tar.gz |
Fixes #7571
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20140729152420_migrate_taggable_labels.rb | 6 |
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 |