Skip to content

Commit e7db645

Browse files
committed
Remove extra establish connection in pending migrations
`purge` always re-establishes the connection at the end so we _should_ always have a connection and shouldn't need to re-establish.
1 parent 86cc3a0 commit e7db645

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

activerecord/lib/active_record/migration.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,6 @@ def check_pending!(connection = Base.connection)
638638
end
639639

640640
def load_schema_if_pending!
641-
current_db_config = Base.connection_db_config
642641
all_configs = db_configs_in_current_env
643642

644643
needs_update = !all_configs.all? do |db_config|
@@ -654,9 +653,6 @@ def load_schema_if_pending!
654653
end
655654
end
656655

657-
# Establish a new connection, the old database may be gone (db:test:prepare uses purge)
658-
Base.establish_connection(current_db_config)
659-
660656
check_pending_migrations(db_configs: all_configs)
661657
end
662658

0 commit comments

Comments
 (0)