Skip to content

Make db:migrate:reset work with GITLAB_USE_MODEL_LOAD_BALANCING=true

What does this MR do and why?

The problem was caused by using the the ActsAsTaggableOn::Tagging model directly which has some weird configuration in https://gitlab.com/gitlab-org/gitlab/-/blob/9c2682cf013dae1d469e6c2c6fea3f6d1aa0fa5a/config/initializers/1_acts_as_taggable.rb#L15 which forces the connection to use the CI connection.

But this doesn't make sense in the migration context where we are migrating the schema for the main database. As such we need to just define a model in the migration like we would normally do then it will use the correct connection for the current migration.

This fixes the following error:

PG::UndefinedTable: ERROR:  relation "taggings" does not exist
LINE 8:  WHERE a.attrelid = '"taggings"'::regclass

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Related to #355573 (closed)

Edited by Dylan Griffith

Merge request reports