Maintenance: Improve performance for db_strategy reset on postgresql.
This commit is contained in:
parent
beee44522b
commit
0b09063197
1 changed files with 12 additions and 3 deletions
|
@ -1,9 +1,18 @@
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
|
|
||||||
config.around(:each, db_strategy: :reset) do |example|
|
config.around(:each, db_strategy: :reset) do |example|
|
||||||
|
if ActiveRecord::Base.connection.instance_values['config'][:adapter] != 'postgresql'
|
||||||
self.use_transactional_tests = false
|
self.use_transactional_tests = false
|
||||||
|
end
|
||||||
example.run
|
example.run
|
||||||
|
if ActiveRecord::Base.connection.instance_values['config'][:adapter] == 'postgresql'
|
||||||
|
Models.all.each_key do |model|
|
||||||
|
model.connection.schema_cache.clear!
|
||||||
|
model.reset_column_information
|
||||||
|
end
|
||||||
|
else
|
||||||
Rake::Task['zammad:db:reset'].reenable
|
Rake::Task['zammad:db:reset'].reenable
|
||||||
Rake::Task['zammad:db:reset'].invoke
|
Rake::Task['zammad:db:reset'].invoke
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue