seeds.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # This file should contain all the record creation needed to seed the database with its default values.
  2. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  3. #
  4. # Examples:
  5. #
  6. # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
  7. # Mayor.create(:name => 'Emanuel', :city => cities.first)
  8. # clear old caches to start from scratch
  9. Cache.clear
  10. # this is the __ordered__ list of seed files
  11. # extend only if needed - try to add your changes
  12. # to the matching one of the existing files
  13. 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]
  14. # loop over and load all seedfiles
  15. # files will get executed automatically
  16. seeds.each do |seed|
  17. # we use load here to be able to re-seed in one process (test env)
  18. load Rails.root.join('db', 'seeds', "#{seed}.rb")
  19. end
  20. # reset primary key sequences
  21. DbHelper.import_post
  22. # install locales and translations
  23. Locale.create_if_not_exists(
  24. locale: 'en-us',
  25. alias: 'en',
  26. name: 'English (United States)',
  27. )
  28. Locale.sync
  29. Translation.sync
  30. Calendar.init_setup
  31. # install all packages in auto_install
  32. Package.auto_install