Finalize `MoveCiBuildsMetadata` and `MoveCiBuildsMetadataSelfManaged` batched background migrations
## Problem
The batched background migrations `MoveCiBuildsMetadata` and `MoveCiBuildsMetadataSelfManaged` need to be finalized before we can proceed with removing code that reads from `ci_builds_metadata` (#552071).
Until these migrations are finalized, we cannot guarantee that all data has been fully migrated from `p_ci_builds_metadata` into the new deduplicated tables, which is a prerequisite for safely removing references to the old table.
## Background
The migrations were introduced and iterated on through the following merge requests:
- !208674 - Original migration to copy builds metadata records to new tables (`MoveCiBuildsMetadata`, .com only)
- !212935 - Requeue migration with per-partition parallelism
- !213860 - Requeue builds metadata migrations for self-managed (`MoveCiBuildsMetadataSelfManaged`)
- !214248 - Add options to reduce the number of migrated rows for self-managed
- !217681 - Fix job artifacts query in builds metadata migration
- !221430 - Parallelize metadata background migration on partition 100
- !222131 - Fix PG::UntranslatableCharacter errors in the migration
### BBM dictionary files
- `db/docs/batched_background_migrations/move_ci_builds_metadata.yml` (introduced in milestone 18.7, queued version `20251117084121`)
- `db/docs/batched_background_migrations/move_ci_builds_metadata_self_managed.yml` (introduced in milestone 18.8, queued version `20260107142958`)
### Migration details
- **`MoveCiBuildsMetadata`**: Runs on GitLab.com. Processes `p_ci_builds` partitions in parallel, migrating data from `p_ci_builds_metadata` into deduplicated tables (`p_ci_job_definitions`, `p_ci_job_definition_instances`, etc.). Partition 100 was further split into view-based parallel migrations.
- **`MoveCiBuildsMetadataSelfManaged`**: Runs only on self-managed installations. Uses the same underlying migration logic as `MoveCiBuildsMetadata` (subclass). Since it only runs on self-managed, there is no .com status to verify, but the code is shared and validated through the .com migration.
## Proposal
1. **Verify `MoveCiBuildsMetadata` is completed** on GitLab.com using chatops:
```
/chatops run batched_background_migrations list --job-class-name=MoveCiBuildsMetadata --database=ci
```
2. **Add finalization migrations** using `ensure_batched_background_migration_is_finished` for both:
- `MoveCiBuildsMetadata` (all partitions and view-based splits)
- `MoveCiBuildsMetadataSelfManaged` (all partitions)
3. **Update the BBM dictionary files** with the `finalized_by` version pointing to the new finalization migration timestamps.
### Documentation reference
See the [database docs for finalizing batched background migrations](https://docs.gitlab.com/ee/development/database/batched_background_migrations.html#finalize-a-batched-background-migration) for the full process.
## Acceptance criteria
- [ ] `MoveCiBuildsMetadata` is confirmed finished on GitLab.com
- [ ] Post-deployment migrations added to finalize both `MoveCiBuildsMetadata` and `MoveCiBuildsMetadataSelfManaged`
- [ ] `finalized_by` field updated in both `db/docs/batched_background_migrations/move_ci_builds_metadata.yml` and `db/docs/batched_background_migrations/move_ci_builds_metadata_self_managed.yml`
- [ ] At least one required stop has passed since the migrations were enqueued
issue