fill_db.rb 733 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env ruby
  2. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  3. require 'rails'
  4. def run
  5. ensure_test_data_present
  6. end
  7. def ensure_test_data_present
  8. puts 'Ensuring test data with 15k tickets is present…'
  9. # Speed up the import
  10. Setting.set('import_mode', true)
  11. suppress_output do
  12. FillDb.load(
  13. agents: 100,
  14. customers: 4000,
  15. groups: 80,
  16. organizations: 400,
  17. overviews: 4,
  18. tickets: 15_000,
  19. nice: 0,
  20. )
  21. end
  22. Setting.set('import_mode', false)
  23. end
  24. def suppress_output
  25. original_stdout = $stdout.clone
  26. $stdout.reopen(File.new('/dev/null', 'w'))
  27. yield
  28. ensure
  29. $stdout.reopen(original_stdout)
  30. end
  31. run