Skip to content

Only track schema versions with actual migrations

Patrick Bair requested to merge pb-dont-create-missing-migration-files into master

What does this MR do?

From discussion in #218590 (closed), a couple issues with the new method of tracking database versions are:

  1. developers/installations have old migration versions in the schema_migrations table, which results in numerous untracked files being created when migrations are run
  2. developers switch between branches, and after running migrations now show untracked files from migrations run on the previous working branch

To address both of these issues a suggestion was made here: #218590 (comment 384984897) to not create a file under db/schema_migrations for versions in the schema_migrations table if there is no corresponding migration file matching that version in either db/migrate or db/post_migrate. This MR implements that suggestion.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Patrick Bair

Merge request reports