Add queued_migration_version to facilitate BBM dependencies
What does this MR do and why?
This adds queued_migration_version
attr to batched_background_migrations table, which will be used by later migrations to establish the dependencies.
More details can be found in #424881 (closed)'s description.
Rationale for choosing migration version:
Version of the migration which enqueued the BBM has been chosen as the unique key for each batched_background_migration, so that it'll be easier to establish the dependencies (instead of mentioning all columns in the existing uniq index) while writing future migrations.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
-
Run migrations to create the necessary attribute
AddQueuedMigrationVersionToBatchedBackgroundMigrations
andAddLimitToQueuedMigrationVersionInBatchedBackgroundMigrations
. -
Enqueue a dummy batched background migration
bundle exec rails g batched_background_migration dummy_batched_migration --table_name=projects --column_name=id --feature_category=database
-
The post migration which calls
queue_batched_background_migration
should have the correctqueued_migration_version
value specified. -
On running the created dummy migration locally,
queued_migration_version
attr will get saved in thebatched_background_migrations
record.bbm = Gitlab::Database::BackgroundMigration::BatchedMigration.last bbm.queued_migration_version
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #424881 (closed)