Fix resetting of attributes in migrations specs

What does this MR do and why?

Refactor the schema migration helpers so that we refresh attribute methods outside the custom connection block.

We are refreshing models from the main DB so we should use the main connection.

This fixes Rails 7.2 failures like: https://gitlab.com/gitlab-org/gitlab/-/jobs/11355753123

We're getting PG::UndefinedTable: ERROR: relation "web_hooks" does not exist because it's using the Geo tracking DB connection to refresh the attribute methods.

References

&17620 (closed)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Heinrich Lee Yu

Merge request reports

Loading