Skip to content

Commit f356e26

Browse files
committed
Fix parallel testing databases
In rails#46270 it was reported that there were database errors when running the tests in an app. I set up a demo app to use parallel testing and was able to reproduce. The issue was that the `reconstruct_from_schema` method needs to use the `pool` and not the `connection` because the database might not exist yet and will raise an error. I don't know how to test this inside Rails but I verified this behavior in my demo app.
1 parent 19b08e2 commit f356e26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/tasks/database_tasks.rb

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

385385
check_schema_file(file) if file
386386

387-
with_temporary_connection(db_config) do
387+
with_temporary_pool(db_config) do
388388
if schema_up_to_date?(db_config, format, file)
389389
truncate_tables(db_config)
390390
else

0 commit comments

Comments
 (0)