20161117000003_store_config_name_update_issue_428.rb 765 B

123456789101112131415161718192021222324252627282930
  1. class StoreConfigNameUpdateIssue428 < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. setting = Setting.find_by(name: 'storage')
  6. return if !setting
  7. setting.name = 'storage_provider'
  8. setting.options = {
  9. form: [
  10. {
  11. display: '',
  12. null: true,
  13. name: 'storage_provider',
  14. tag: 'select',
  15. tranlate: true,
  16. options: {
  17. 'DB' => 'Database',
  18. 'File' => 'Filesystem',
  19. },
  20. },
  21. ],
  22. }
  23. setting.preferences = {
  24. controller: 'SettingsAreaStorageProvider',
  25. online_service_disable: true,
  26. permission: ['admin.system'],
  27. }
  28. setting.save!
  29. end
  30. end