Skip to content

Implement migration skipping when `RestrictGitlabSchema` is used

Kamil Trzciński requested to merge skip-migrations-softly into master

What does this MR do and why?

It does use information of database_tasks: false to know that such connections are being shared with main: (a primary connection).

Such migrations even if two connections are present will be run on top of main: connection. This does solve migrations skipping/restrict approach since:

  1. If database_tasks: true is used, the migration will be run everywhere, but some with restrict* will be skipped (a message will be printed, and they will be marked via schema_migrations as run)
  2. If database_tasks: false is used, the migration will be run only on main:, since no db:migrate:ci will exist. Such migration will not be skipped, and instead it will be run in-order on top of main:

This does enforce usage of gitlab:db:validate_config in production to ensure that if migrations are skipped are actually correctly skipped.

Related:

Those MRs needs to be merged before this one can be:

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 Kamil Trzciński

Merge request reports