20231107090334_simple_storage_configuration_check.rb 563 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class SimpleStorageConfigurationCheck < ActiveRecord::Migration[7.0]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. s3_setting = Setting.find_by(name: 'storage_provider')
  7. return if !s3_setting
  8. add_validations(s3_setting)
  9. s3_setting.save!(validate: false)
  10. end
  11. private
  12. def add_validations(s3_setting)
  13. s3_setting.preferences[:validations] = ['Setting::Validation::StorageProvider']
  14. true
  15. end
  16. end