Skip to content

ReplaceTable helper should be passed a connection

Patrick Bair requested to merge pb-connections-in-partitioning-helpers into master

What does this MR do and why?

Updates the ReplaceTable helper to use an externally provided connection, rather than rely on ActiveRecord::Base.connection directly. This makes the class safe for multiple databases, since it expects to be provided with the appropriate connection.

In practice this class is only used by partitioning migration helpers. The helpers use the connection object directly exposed in a migration, which we will know will be configured to point to the correct database for that particular migration.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Patrick Bair

Merge request reports