[Code Embeddings] Update number_of_partitions in the migration

Context

Update the number_of_partitions in the ActiveContext Code collection migration.

The change should be:

diff --git a/ee/db/active_context/migrate/20250423135734_create_code.rb b/ee/db/active_context/migrate/20250423135734_create_code.rb
index 3de7578ca8e0..e7c533e03c76 100644
--- a/ee/db/active_context/migrate/20250423135734_create_code.rb
+++ b/ee/db/active_context/migrate/20250423135734_create_code.rb
@@ -3,12 +3,8 @@
 class CreateCode < ActiveContext::Migration[1.0]
   milestone '18.0'
 
-  # Set number of partitions based on expected number of documents before enabling gem in production
-  # https://gitlab.com/gitlab-org/gitlab/-/issues/536216#note_2484267969
-  NUMBER_OF_PARTITIONS = 1
-
   def migrate!
-    create_collection :code, number_of_partitions: NUMBER_OF_PARTITIONS, options: { include_ref_fields: false } do |c|
+    create_collection :code, number_of_partitions: number_of_partitions, options: { include_ref_fields: false } do |c|
       c.keyword :id
       c.bigint :project_id
       c.keyword :path
@@ -20,4 +16,10 @@ def migrate!
       c.vector :embeddings_v1, dimensions: 768
     end
   end
+
+  def number_of_partitions
+    return 1 unless Gitlab.org_or_com?
+
+    # return number based on calculations in https://gitlab.com/gitlab-org/gitlab/-/issues/551852
+  end
 end
Edited by 🤖 GitLab Bot 🤖