From 9cc605b0b2cdea2f07dfeb89051303b30a7f0734 Mon Sep 17 00:00:00 2001
From: gdk <gdk@example.com>
Date: Sun, 3 Nov 2024 23:20:58 +0000
Subject: [PATCH] Finalize migration BackfillJiraTrackerDataProjectKeys

This migration was finished at `2024-04-19 18:50:03 UTC`, you can confirm
the status using our
[batched background migration chatops commands](https://docs.gitlab.com/ee/development/database/batched_background_migrations.html#monitor-the-progress-and-status-of-a-batched-background-migration).
  To confirm it is finished you can run:

  ```
/chatops run batched_background_migrations status 1000503
```

The last time this background migration was triggered was in [db/post_migrate/20240402143848_queue_backfill_jira_tracker_data_project_keys.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/post_migrate/20240402143848_queue_backfill_jira_tracker_data_project_keys.rb)

  You can read more about the process for finalizing batched background migrations in
https://docs.gitlab.com/ee/development/database/batched_background_migrations.html .

  As part of our process we want to ensure all batched background migrations have had at least one
[required stop](https://docs.gitlab.com/ee/development/database/required_stops.html)
to process the migration. Therefore we can finalize any batched background migration that was added before the
last required stop.

This change was generated by
[gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper)
using the Keeps::OverdueFinalizeBackgroundMigration keep.

To provide feedback on your experience with `gitlab-housekeeper` please create an issue with the
label ~"GitLab Housekeeper" and consider pinging the author of this keep.

Changelog: other
---
 ...ackfill_jira_tracker_data_project_keys.yml |  4 +++-
 ...backfill_jira_tracker_data_project_keys.rb | 21 +++++++++++++++++++
 db/schema_migrations/20241103232044           |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 db/post_migrate/20241103232044_finalize_backfill_jira_tracker_data_project_keys.rb
 create mode 100644 db/schema_migrations/20241103232044

diff --git a/db/docs/batched_background_migrations/backfill_jira_tracker_data_project_keys.yml b/db/docs/batched_background_migrations/backfill_jira_tracker_data_project_keys.yml
index 09e263b57d298..3a2a40de32dcd 100644
--- a/db/docs/batched_background_migrations/backfill_jira_tracker_data_project_keys.yml
+++ b/db/docs/batched_background_migrations/backfill_jira_tracker_data_project_keys.yml
@@ -1,7 +1,9 @@
 ---
 migration_job_name: BackfillJiraTrackerDataProjectKeys
-description: Populate project_keys with project_key if project_keys hasn't been copied yet
+description: Populate project_keys with project_key if project_keys hasn't been copied
+  yet
 feature_category: integrations
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148433
 milestone: '17.0'
 queued_migration_version: 20240402143848
+finalized_by: '20241103232044'
diff --git a/db/post_migrate/20241103232044_finalize_backfill_jira_tracker_data_project_keys.rb b/db/post_migrate/20241103232044_finalize_backfill_jira_tracker_data_project_keys.rb
new file mode 100644
index 0000000000000..e1e13e99b91c1
--- /dev/null
+++ b/db/post_migrate/20241103232044_finalize_backfill_jira_tracker_data_project_keys.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class FinalizeBackfillJiraTrackerDataProjectKeys < Gitlab::Database::Migration[2.2]
+  milestone '17.6'
+
+  disable_ddl_transaction!
+
+  restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+  def up
+    ensure_batched_background_migration_is_finished(
+      job_class_name: 'BackfillJiraTrackerDataProjectKeys',
+      table_name: :jira_tracker_data,
+      column_name: :id,
+      job_arguments: [],
+      finalize: true
+    )
+  end
+
+  def down; end
+end
diff --git a/db/schema_migrations/20241103232044 b/db/schema_migrations/20241103232044
new file mode 100644
index 0000000000000..64e0ae577c8f6
--- /dev/null
+++ b/db/schema_migrations/20241103232044
@@ -0,0 +1 @@
+0ee481d9ade7057925a68442388aa7cf507e6660fd7b538cf5f3eccc30b33028
\ No newline at end of file
-- 
GitLab