diff --git a/db/docs/batched_background_migrations/backfill_code_suggestions_namespace_settings.yml b/db/docs/batched_background_migrations/backfill_code_suggestions_namespace_settings.yml
index 23f3fd4317408525f08fae8a13622cfe7f647064..a6e04394d2446c9b6cc718305c51a14f61e683d7 100644
--- a/db/docs/batched_background_migrations/backfill_code_suggestions_namespace_settings.yml
+++ b/db/docs/batched_background_migrations/backfill_code_suggestions_namespace_settings.yml
@@ -4,3 +4,4 @@ description: Updates default value of code_suggestions on namespace_settings tab
 feature_category: code_suggestions
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121126
 milestone: '16.1'
+finalized_by: '20231206145850'
diff --git a/db/post_migrate/20231206145850_finalize_backfill_code_suggestions_namespace_settings.rb b/db/post_migrate/20231206145850_finalize_backfill_code_suggestions_namespace_settings.rb
new file mode 100644
index 0000000000000000000000000000000000000000..3aa30ef2bb6a310db9c45d3ecf02464ee7a64efe
--- /dev/null
+++ b/db/post_migrate/20231206145850_finalize_backfill_code_suggestions_namespace_settings.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class FinalizeBackfillCodeSuggestionsNamespaceSettings < Gitlab::Database::Migration[2.2]
+  milestone '16.7'
+
+  disable_ddl_transaction!
+
+  restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
+
+  def up
+    ensure_batched_background_migration_is_finished(
+      job_class_name: 'BackfillCodeSuggestionsNamespaceSettings',
+      table_name: :namespace_settings,
+      column_name: :namespace_id,
+      job_arguments: [],
+      finalize: true
+    )
+  end
+
+  def down; end
+end
diff --git a/db/schema_migrations/20231206145850 b/db/schema_migrations/20231206145850
new file mode 100644
index 0000000000000000000000000000000000000000..6d291813c04453eaf498abe00767cca2cbea8b3f
--- /dev/null
+++ b/db/schema_migrations/20231206145850
@@ -0,0 +1 @@
+53442f9c3ef0e0f3f31b4be177faf3d073ee8b74d20ede7a1673bedfa097f0b9
\ No newline at end of file