Skip to content

Draft: Skip migrations from running when `database_tasks: false` is set

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).

The usage of database_tasks: false makes to not run migrations on top of connection marked as this like ci:. To ensure that database_tasks: true/false is properly used this does implement gitlab:db:validate_config for that.

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:

This makes it possible to softly skip migrations (print information) if we have two connections using two databases.

Resolves:

Related:

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

Loading