Maintenance: Ensure synchronousness between ActiveRecord Model column information and actual DB after resetting DB in tests.
This commit is contained in:
parent
8a3be0488d
commit
ed4f593c8b
1 changed files with 2 additions and 2 deletions
|
@ -7,7 +7,7 @@ namespace :zammad do
|
||||||
|
|
||||||
# we loop over each dependent task to be able to
|
# we loop over each dependent task to be able to
|
||||||
# execute them and their prerequisites multiple times (in tests)
|
# 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|
|
%w[db:drop:_unsafe db:create db:schema:load db:seed].each do |task|
|
||||||
|
|
||||||
$stdout = StringIO.new if task == 'db:schema:load'.freeze
|
$stdout = StringIO.new if task == 'db:schema:load'.freeze
|
||||||
|
@ -16,10 +16,10 @@ namespace :zammad do
|
||||||
Rake::Task[task].invoke
|
Rake::Task[task].invoke
|
||||||
ensure
|
ensure
|
||||||
$stdout = STDOUT
|
$stdout = STDOUT
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ActiveRecord::Base.connection.reconnect!
|
ActiveRecord::Base.connection.reconnect!
|
||||||
|
ActiveRecord::Base.descendants.each(&:reset_column_information)
|
||||||
Cache.clear
|
Cache.clear
|
||||||
Setting.reload
|
Setting.reload
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue