<commit_before>namespace :zammad do

  namespace :db do

    desc 'Drops, recreates and seeds the database, clears the Cache and reloads the Settings'
    task reset: :environment do

      # we loop over each dependent task to be able to
      # execute them and their prerequisites multiple times (in tests)
      # there is no way in rake to achieve that
      %w[db:drop:_unsafe db:create db:schema:load db:seed].each do |task|

        $stdout = StringIO.new if task == 'db:schema:load'.freeze

        Rake::Task[task].reenable
        Rake::Task[task].invoke
      ensure
        $stdout = STDOUT
      end

      Package::Migration.linked
      ActiveRecord::Base.connection.reconnect!
      ActiveRecord::Base.descendants.each(&:reset_column_information)
      Cache.clear
      Setting.reload
    end
  end
end
<commit_msg>Follow up - <PASSWORD> - Maintenance: CI DB created from schema already contains tables of CD packages that should get created via migration files of the Package.<commit_after>namespace :zammad do

  namespace :db do

    desc 'Drops, recreates and seeds the database, clears the Cache and reloads the Settings'
    task reset: :environment do

      # we loop over each dependent task to be able to
      # execute them and their prerequisites multiple times (in tests)
      # there is no way in rake to achieve that
      %w[db:drop:_unsafe db:create db:migrate db:seed].each do |task|

        $stdout = StringIO.new if task == 'db:migrate'.freeze

        Rake::Task[task].reenable
        Rake::Task[task].invoke
      ensure
        $stdout = STDOUT
      end

      Package::Migration.linked
      ActiveRecord::Base.connection.reconnect!
      ActiveRecord::Base.descendants.each(&:reset_column_information)
      Cache.clear
      Setting.reload
    end
  end
end

{'fraction_non_alphanumeric': 0.0774764803541782, 'fraction_numerical': 0.0, 'mean_word_length': 2.9304347826086956, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '946301', 'n_tokens_mistral': 521, 'n_tokens_neox': 498, 'n_words': 178}