summaryrefslogtreecommitdiff
path: root/db/migrate/20150425164647_remove_duplicate_tags.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-07-03 10:28:13 +0100
committerSean McGivern <sean@gitlab.com>2019-07-03 10:28:13 +0100
commitb94daa35a4be584623792653b537d6ab68bdabdd (patch)
treecd620ef82dc85cec1cb401c7a5cf880c47418708 /db/migrate/20150425164647_remove_duplicate_tags.rb
parent83330822d6ee3c59a057adeda35b23ab0021b63a (diff)
parentf90a7601c40c82bd230f9c014bc4f64744e77b5e (diff)
downloadgitlab-ce-b94daa35a4be584623792653b537d6ab68bdabdd.tar.gz
Merge branch 'master' into michel.engelen/gitlab-ce-issue/55953
Diffstat (limited to 'db/migrate/20150425164647_remove_duplicate_tags.rb')
-rw-r--r--db/migrate/20150425164647_remove_duplicate_tags.rb18
1 files changed, 0 insertions, 18 deletions
diff --git a/db/migrate/20150425164647_remove_duplicate_tags.rb b/db/migrate/20150425164647_remove_duplicate_tags.rb
deleted file mode 100644
index 5165eb65695..00000000000
--- a/db/migrate/20150425164647_remove_duplicate_tags.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# rubocop:disable all
-class RemoveDuplicateTags < ActiveRecord::Migration[4.2]
- def up
- select_all("SELECT name, COUNT(id) as cnt FROM tags GROUP BY name HAVING COUNT(id) > 1").each do |tag|
- tag_name = quote_string(tag["name"])
- duplicate_ids = select_all("SELECT id FROM tags WHERE name = '#{tag_name}'").map{|tag| tag["id"]}
- origin_tag_id = duplicate_ids.first
- duplicate_ids.delete origin_tag_id
-
- execute("UPDATE taggings SET tag_id = #{origin_tag_id} WHERE tag_id IN(#{duplicate_ids.join(",")})")
- execute("DELETE FROM tags WHERE id IN(#{duplicate_ids.join(",")})")
- end
- end
-
- def down
-
- end
-end