From a1ddb08e29b56086b91a91c711f7dc1ea8812ded Mon Sep 17 00:00:00 2001
From: Maxime Orefice <morefice@gitlab.com>
Date: Thu, 4 Jan 2024 11:30:53 +0100
Subject: [PATCH] Finalize BackfillPartitionIdCiPipelineChatData

Changelog: added
---
 ...ill_partition_id_ci_pipeline_chat_data.yml |  2 +-
 ...fill_partition_id_ci_pipeline_chat_data.rb | 23 +++++++++++++++++++
 db/schema_migrations/20240104101601           |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 db/post_migrate/20240104101601_finalize_backfill_partition_id_ci_pipeline_chat_data.rb
 create mode 100644 db/schema_migrations/20240104101601

diff --git a/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_chat_data.yml b/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_chat_data.yml
index 9cf851d91041b..5864ef96ca3b5 100644
--- a/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_chat_data.yml
+++ b/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_chat_data.yml
@@ -6,4 +6,4 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139515
 milestone: '16.8'
 queued_migration_version: 20231218092401
 finalize_after: '2023-12-23'
-finalized_by: # version of the migration that finalized this BBM
+finalized_by: 20240104101601
diff --git a/db/post_migrate/20240104101601_finalize_backfill_partition_id_ci_pipeline_chat_data.rb b/db/post_migrate/20240104101601_finalize_backfill_partition_id_ci_pipeline_chat_data.rb
new file mode 100644
index 0000000000000..45da0e9c12aa0
--- /dev/null
+++ b/db/post_migrate/20240104101601_finalize_backfill_partition_id_ci_pipeline_chat_data.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class FinalizeBackfillPartitionIdCiPipelineChatData < Gitlab::Database::Migration[2.2]
+  milestone '16.8'
+  MIGRATION = 'BackfillPartitionIdCiPipelineChatData'
+  disable_ddl_transaction!
+
+  restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+  def up
+    ensure_batched_background_migration_is_finished(
+      job_class_name: MIGRATION,
+      table_name: :ci_pipeline_chat_data,
+      column_name: :id,
+      job_arguments: [],
+      finalize: true
+    )
+  end
+
+  def down
+    # no-op
+  end
+end
diff --git a/db/schema_migrations/20240104101601 b/db/schema_migrations/20240104101601
new file mode 100644
index 0000000000000..06c9bee807e07
--- /dev/null
+++ b/db/schema_migrations/20240104101601
@@ -0,0 +1 @@
+729cc1d2d73610b8e1a8efec30635dded7c85ece9afdc40e24ed60ddd82c4068
\ No newline at end of file
-- 
GitLab