20220829140334_issue4229_overview_user_sortings.rb 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue4229OverviewUserSortings < ActiveRecord::Migration[6.1]
  3. def change
  4. return if !Setting.exists?(name: 'system_init_done')
  5. create_table :user_overview_sortings do |t|
  6. t.column :user_id, :integer, null: false
  7. t.column :overview_id, :integer, null: false
  8. t.column :prio, :integer, null: false
  9. t.integer :updated_by_id, null: false
  10. t.integer :created_by_id, null: false
  11. t.timestamps limit: 3, null: false
  12. end
  13. add_index :user_overview_sortings, :user_id
  14. add_index :user_overview_sortings, :overview_id
  15. add_foreign_key :user_overview_sortings, :users, column: :created_by_id
  16. add_foreign_key :user_overview_sortings, :users, column: :updated_by_id
  17. add_foreign_key :user_overview_sortings, :users, column: :user_id
  18. Permission.create_if_not_exists(
  19. name: 'user_preferences.overview_sorting',
  20. note: 'Change %s',
  21. preferences: {
  22. translations: ['Order of Overviews'],
  23. required: ['ticket.agent'],
  24. },
  25. allow_signup: true,
  26. )
  27. end
  28. end