mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 04:36:11 +10:00
Merge branch 'quote_string' into 'master'
Adding quote_string to migration See merge request !630
This commit is contained in:
committed by
Dmitriy Zaporozhets
parent
afff570522
commit
f876b7cae6
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user