diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-05-08 16:54:45 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-05-08 16:54:45 +0300 |
commit | 3bc717f01075f5dd2ae8968002525b5237601b12 (patch) | |
tree | f8e204f87649dd63d6626dc39a280d586e4e598c /db/migrate | |
parent | 8a413174a5ac73e67b74c2e71c28e8e8af6c36b3 (diff) | |
download | gitlab-ce-3bc717f01075f5dd2ae8968002525b5237601b12.tar.gz |
Adding quote_string to migrationquote_string
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20150425164647_remove_duplicate_tags.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/db/migrate/20150425164647_remove_duplicate_tags.rb b/db/migrate/20150425164647_remove_duplicate_tags.rb index 1a9152cb965..13e5038db9c 100644 --- a/db/migrate/20150425164647_remove_duplicate_tags.rb +++ b/db/migrate/20150425164647_remove_duplicate_tags.rb @@ -1,7 +1,8 @@ class RemoveDuplicateTags < ActiveRecord::Migration def up select_all("SELECT name, COUNT(id) as cnt FROM tags GROUP BY name HAVING COUNT(id) > 1").each do |tag| - duplicate_ids = select_all("SELECT id FROM tags WHERE name = '#{tag["name"]}'").map{|tag| tag["id"]} + 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 |