seeds.rb 901 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. # inital data set as extention to db/seeds.rb
  3. Trigger.destroy_all
  4. Job.destroy_all
  5. # create email address and apply it to all groups
  6. channel_id = nil
  7. channel = Channel.find_by(area: 'Email::Notification', active: true)
  8. if channel
  9. channel_id = channel.id
  10. end
  11. email_address = EmailAddress.create_or_update(
  12. realname: 'Zammad',
  13. email: 'zammad@localhost',
  14. channel_id: channel_id,
  15. updated_by_id: 1,
  16. created_by_id: 1
  17. )
  18. Group.all.each do |group|
  19. group.email_address_id = email_address.id
  20. group.save!
  21. end
  22. User.create_or_update(
  23. login: 'admin@example.com',
  24. firstname: 'Default',
  25. lastname: 'Admin',
  26. email: 'admin@example.com',
  27. password: 'adminpw',
  28. active: true,
  29. roles: Role.where(name: %w[Admin]),
  30. updated_by_id: 1,
  31. created_by_id: 1,
  32. )