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/20220428071221_restore_defa...

22 lines
519 B

class RestoreDefaultsOnEmptySettings < ActiveRecord::Migration[6.1]
def up
settings = Setting.where(value: '')
settings.find_each do |setting|
definition = Settings::Definition[setting.name]
if definition.nil?
warn "Did not find definition for #{setting.name}. This setting is probably outdated an can be removed."
next
end
next if definition.value == ''
setting.update_column(:value, definition.value)
end
end
def down
# Nothing to do
end
end