diff --git a/db/docs/batched_background_migrations/backfill_approval_merge_request_rule_sources_project_id.yml b/db/docs/batched_background_migrations/backfill_approval_merge_request_rule_sources_project_id.yml index af6ad021d4e66651d8701e347e94b34435ffe3b4..7c418f0821ec5f0acdc3623f575c37b4ac73ca7f 100644 --- a/db/docs/batched_background_migrations/backfill_approval_merge_request_rule_sources_project_id.yml +++ b/db/docs/batched_background_migrations/backfill_approval_merge_request_rule_sources_project_id.yml @@ -1,8 +1,9 @@ --- migration_job_name: BackfillApprovalMergeRequestRuleSourcesProjectId -description: Backfills sharding key `approval_merge_request_rule_sources.project_id` from `approval_project_rules`. +description: Backfills sharding key `approval_merge_request_rule_sources.project_id` + from `approval_project_rules`. feature_category: code_review_workflow introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151629 milestone: '17.0' queued_migration_version: 20240501044238 -finalized_by: # version of the migration that finalized this BBM +finalized_by: '20241001231957' diff --git a/db/post_migrate/20241001231957_finalize_backfill_approval_merge_request_rule_sources_project_id.rb b/db/post_migrate/20241001231957_finalize_backfill_approval_merge_request_rule_sources_project_id.rb new file mode 100644 index 0000000000000000000000000000000000000000..6f07bc3d39baf7673f001b42a720e7d2fb1be4b3 --- /dev/null +++ b/db/post_migrate/20241001231957_finalize_backfill_approval_merge_request_rule_sources_project_id.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class FinalizeBackfillApprovalMergeRequestRuleSourcesProjectId < Gitlab::Database::Migration[2.2] + milestone '17.5' + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main_cell + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'BackfillApprovalMergeRequestRuleSourcesProjectId', + table_name: :approval_merge_request_rule_sources, + column_name: :id, + job_arguments: [:project_id, :approval_project_rules, :project_id, :approval_project_rule_id], + finalize: true + ) + end + + def down; end +end diff --git a/db/schema_migrations/20241001231957 b/db/schema_migrations/20241001231957 new file mode 100644 index 0000000000000000000000000000000000000000..97cc01f80f6f3ece7deebeb9282ac346524c4633 --- /dev/null +++ b/db/schema_migrations/20241001231957 @@ -0,0 +1 @@ +d82d6a9807834b8c810bb3fe740817b78bc7a6de6b29972b0c186a687bdb1b90 \ No newline at end of file