20231115110546_create_system_report.rb 747 B

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class CreateSystemReport < ActiveRecord::Migration[7.0]
  3. def change
  4. return if !Setting.exists?(name: 'system_init_done')
  5. setup_table
  6. setup_permissions
  7. end
  8. def setup_table
  9. create_table :system_reports do |t|
  10. t.text :data
  11. t.string :uuid, limit: 50, null: false
  12. t.integer :created_by_id, null: false
  13. t.timestamps limit: 3, null: false
  14. end
  15. add_index :system_reports, [:uuid], unique: true
  16. end
  17. def setup_permissions
  18. Permission.create_if_not_exists(
  19. name: 'admin.system_report',
  20. note: 'Manage %s',
  21. preferences: {
  22. translations: ['System Report']
  23. },
  24. )
  25. end
  26. end