Improve handling of obsolete migrations

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Now that we have an Advanced Search migration graveyard, we can remove really old deprecated migrations from the code base. Instead of relying on the Elastic::MigrationObsolete module, let's create a registry that can be used as a start-up check before running migrations. If a migration in the registry is obsolete and is about to be executed, the error in Elastic::MigrationObsolete should be raised and migration should be halted.

  • A migration would always return true as completed if it is marked obsolete.
  • If a migration is obsolete but is used in the code base, we should log a deprecation warning.
  • A spec failure would need to be raised if a migration is in the registry but not in the filesystem.
  • When a migration is removed from filesystem, we would remove from registry as well. An exception would be raised. (This code already exists in MigrationRecord.find_by_name!)

Have a YAML registry:

add_hidden_to_issues:
  obsolete: true
  marked_obsolete_in: "16.0"

Once the registry is in place, we can update the archive script to use it accordingly.

Edited by 🤖 GitLab Bot 🤖