gitlab-org--gitlab-foss/db/migrate/20140407135544_fix_namespaces.rb

18 lines
384 B
Ruby
Raw Normal View History

# rubocop:disable all
2014-04-07 10:03:49 -04:00
class FixNamespaces < ActiveRecord::Migration
DOWNTIME = false
2014-04-07 10:03:49 -04:00
def up
namespaces = exec_query('SELECT id, path FROM namespaces WHERE name <> path and type is null')
namespaces.each do |row|
id = row['id']
path = row['path']
exec_query("UPDATE namespaces SET name = '#{path}' WHERE id = #{id}")
2014-04-07 10:03:49 -04:00
end
end
def down
end
end