seeds.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. # This file should contain all the record creation needed to seed the database with its default values.
  3. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  4. #
  5. # Examples:
  6. #
  7. # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
  8. # Mayor.create(:name => 'Emanuel', :city => cities.first)
  9. # clear old caches to start from scratch
  10. Cache.clear
  11. # this is the __ordered__ list of seed files
  12. # extend only if needed - try to add your changes
  13. # to the matching one of the existing files
  14. seeds = %w[settings user_nr_1 signatures roles permissions groups links ticket_state_types ticket_states ticket_priorities ticket_article_types ticket_article_senders macros community_user_resources overviews channels report_profiles chats object_manager_attributes schedulers triggers karma_activities core_workflow]
  15. # loop over and load all seedfiles
  16. # files will get executed automatically
  17. seeds.each do |seed|
  18. # we use load here to be able to re-seed in one process (test env)
  19. load Rails.root.join('db', 'seeds', "#{seed}.rb")
  20. end
  21. # reset primary key sequences
  22. DbHelper.import_post
  23. # install locales and translations
  24. Locale.create_if_not_exists(
  25. locale: 'en-us',
  26. alias: 'en',
  27. name: __('English (United States)'),
  28. )
  29. Locale.sync
  30. Translation.sync
  31. Calendar.init_setup
  32. # install all packages in auto_install
  33. Package.auto_install