From ed4f593c8b822fbfd61858ca29c9c820a9cbdd1d Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 13 Aug 2020 09:47:51 +0200 Subject: [PATCH] Maintenance: Ensure synchronousness between ActiveRecord Model column information and actual DB after resetting DB in tests. --- lib/tasks/zammad/db/reset.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/zammad/db/reset.rake b/lib/tasks/zammad/db/reset.rake index 214fce821..dd3034156 100644 --- a/lib/tasks/zammad/db/reset.rake +++ b/lib/tasks/zammad/db/reset.rake @@ -7,7 +7,7 @@ namespace :zammad 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 achive that + # 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 @@ -16,10 +16,10 @@ namespace :zammad do Rake::Task[task].invoke ensure $stdout = STDOUT - end ActiveRecord::Base.connection.reconnect! + ActiveRecord::Base.descendants.each(&:reset_column_information) Cache.clear Setting.reload end