Skip to content

Commit e8e077d

Browse files
authored
Add ENV["SKIP_TEST_DATABASE_TRUNCATE"] flag to speed up multi-process test runs (rails#51686)
1 parent 9ad3685 commit e8e077d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Add ENV["SKIP_TEST_DATABASE_TRUNCATE"] flag to speed up multi-process test runs on large DBs when all tests run within default txn. (This cuts ~10s from the test run of HEY when run by 24 processes against the 178 tables, since ~4,000 table truncates can then be skipped.)
2+
3+
*DHH*
4+
15
* Added support for recursive common table expressions.
26

37
```ruby

activerecord/lib/active_record/tasks/database_tasks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def reconstruct_from_schema(db_config, format = ActiveRecord.schema_format, file
390390

391391
with_temporary_pool(db_config, clobber: true) do
392392
if schema_up_to_date?(db_config, format, file)
393-
truncate_tables(db_config)
393+
truncate_tables(db_config) unless ENV["SKIP_TEST_DATABASE_TRUNCATE"]
394394
else
395395
purge(db_config)
396396
load_schema(db_config, format, file)

0 commit comments

Comments
 (0)