2019-02-15 15:39:39 +05:30
|
|
|
class FixNamespaces < ActiveRecord::Migration[4.2]
|
2016-09-13 17:45:13 +05:30
|
|
|
DOWNTIME = false
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
def up
|
2016-09-13 17:45:13 +05:30
|
|
|
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-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|