OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/db/migrate/20190618115620_fix_availabl...

33 lines
760 B

class FixAvailableLanguages < ActiveRecord::Migration[5.2]
def up
if Setting.exists?(name: 'available_languages')
Setting.reset_column_information
Setting.available_languages = Setting.available_languages.map do |lang|
if lang == 'zh'
'zh-CN'
else
lang
end
end
end
User.where(language: 'zh').update_all(language: 'zh-CN')
end
def down
if Setting.exists?(name: 'available_languages')
Setting.reset_column_information
Setting.available_languages = Setting.available_languages.map do |lang|
if lang == 'zh-CN'
'zh'
else
lang
end
end
end
User.where(language: 'zh-CN').update_all(language: 'zh')
end
end