Project

General

Profile

« Previous | Next » 

Revision c791f6c7

Added by Ondřej Ezr over 1 year ago

Fixes #29939 - drop category column from settings

Settings table was holding category column to support old style of
settings, but it is now ready to be decomissioned as plugins were given
enough time.

View differences:

app/services/setting_registry.rb
end
end
def known_categories
unless @known_descendants == Setting.descendants
@known_descendants = Setting.descendants
@known_categories = @known_descendants.map(&:name) << 'Setting'
@values_loaded_at = nil # force all values to be reloaded
end
@known_categories
end
def load_values(ignore_cache: false)
# we are loading only known STIs as we load settings fairly early the first time and plugin classes might not be loaded yet.
settings = Setting.unscoped.where(category: known_categories)
settings = Setting.unscoped
settings = settings.where('updated_at >= ?', @values_loaded_at) unless ignore_cache || @values_loaded_at.nil?
settings.each do |s|
unless (definition = find(s.name))
......
end
def _new_db_record(definition)
Setting.new(name: definition.name,
value: definition.value,
category: definition.category.safe_constantize&.name || 'Setting')
Setting.new(name: definition.name, value: definition.value)
end
end

Also available in: Unified diff