20211220145252_create_ticket_shared_drafts.rb 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class CreateTicketSharedDrafts < ActiveRecord::Migration[5.0]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. create_table :ticket_shared_draft_zooms do |t|
  7. t.references :ticket, null: false, foreign_key: { to_table: :tickets }
  8. t.text :new_article
  9. t.text :ticket_attributes
  10. t.column :created_by_id, :integer, null: true
  11. t.column :updated_by_id, :integer, null: true
  12. t.timestamps limit: 3
  13. end
  14. create_table :ticket_shared_draft_starts do |t|
  15. t.references :group, null: false, foreign_key: { to_table: :groups }
  16. t.string :name
  17. t.text :content
  18. t.column :created_by_id, :integer, null: true
  19. t.column :updated_by_id, :integer, null: true
  20. t.timestamps limit: 3
  21. end
  22. change_table :groups do |t|
  23. t.boolean :shared_drafts, null: false, default: true
  24. end
  25. Group.reset_column_information
  26. UserInfo.current_user_id = 1
  27. ObjectManager::Attribute.add(
  28. force: true,
  29. object: 'Group',
  30. name: 'shared_drafts',
  31. display: 'Shared Drafts',
  32. data_type: 'active',
  33. data_option: {
  34. null: false,
  35. default: true,
  36. permission: ['admin.group'],
  37. },
  38. editable: true,
  39. active: true,
  40. screens: {
  41. create: {
  42. '-all-' => {
  43. null: false,
  44. },
  45. },
  46. edit: {
  47. '-all-': {
  48. null: false,
  49. },
  50. },
  51. view: {
  52. '-all-' => {
  53. shown: false,
  54. },
  55. },
  56. },
  57. to_create: false,
  58. to_migrate: false,
  59. to_delete: false,
  60. position: 1400,
  61. )
  62. end
  63. end