BigW Consortium Gitlab

20140407135544_fix_namespaces.rb 384 Bytes
Newer Older
1
# rubocop:disable all
2
class FixNamespaces < ActiveRecord::Migration
3 4
  DOWNTIME = false

5
  def up
6 7 8 9 10 11
    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}")
12 13 14 15 16
    end
  end

  def down
  end
17
end