seeds.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # encoding: utf-8
  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)
  15. # loop and require all seedfiles
  16. # files will get executed automatically
  17. seeds.each do |seed|
  18. # we use require relative here since
  19. # - we the seeds file to get loaded only once
  20. # - we want to require it relative to the current path
  21. require_relative "seeds/#{seed}.rb"
  22. end
  23. # reset primary key sequences
  24. DbHelper.import_post
  25. # install locales and translations
  26. Locale.create_if_not_exists(
  27. locale: 'en-us',
  28. alias: 'en',
  29. name: 'English (United States)',
  30. )
  31. Locale.sync
  32. Translation.sync
  33. Calendar.init_setup
  34. # install all packages in auto_install
  35. Package.auto_install