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:
Diffstat (limited to 'db/migrate/20150306023106_fix_namespace_duplication.rb')
-rw-r--r--db/migrate/20150306023106_fix_namespace_duplication.rb21
1 files changed, 0 insertions, 21 deletions
diff --git a/db/migrate/20150306023106_fix_namespace_duplication.rb b/db/migrate/20150306023106_fix_namespace_duplication.rb
deleted file mode 100644
index 334e5574559..00000000000
--- a/db/migrate/20150306023106_fix_namespace_duplication.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class FixNamespaceDuplication < ActiveRecord::Migration
- def up
- #fixes path duplication
- select_all('SELECT MAX(id) max, COUNT(id) cnt, path FROM namespaces GROUP BY path HAVING COUNT(id) > 1').each do |nms|
- bad_nms_ids = select_all("SELECT id FROM namespaces WHERE path = '#{nms['path']}' AND id <> #{nms['max']}").map{|x| x["id"]}
- execute("UPDATE projects SET namespace_id = #{nms["max"]} WHERE namespace_id IN(#{bad_nms_ids.join(', ')})")
- execute("DELETE FROM namespaces WHERE id IN(#{bad_nms_ids.join(', ')})")
- end
-
- #fixes name duplication
- select_all('SELECT MAX(id) max, COUNT(id) cnt, name FROM namespaces GROUP BY name HAVING COUNT(id) > 1').each do |nms|
- bad_nms_ids = select_all("SELECT id FROM namespaces WHERE name = '#{nms['name']}' AND id <> #{nms['max']}").map{|x| x["id"]}
- execute("UPDATE projects SET namespace_id = #{nms["max"]} WHERE namespace_id IN(#{bad_nms_ids.join(', ')})")
- execute("DELETE FROM namespaces WHERE id IN(#{bad_nms_ids.join(', ')})")
- end
- end
-
- def down
- # not implemented
- end
-end