Create new schema definition without assignee field.

We are removing assignee functionality. The assignee field will be
removed from Change. Therefore we make the getter always return
NO_ASSIGNEE.

The previous changes in the stack of changes removing assignee
functionality. Already removed all usages of Assignee field (read and
write) RestApi, Querying, Reading from and setting to Notedb. Meaning
that assignee is not populated for both the older version of index
(because it's not read from notedb and can't be changed via rest) and
for the new version of index (because we remove it from schema)

Google-Bug-Id: b/267456422
Release-Notes: skip
Change-Id: I0e82803c635f5fb1e0bdc2f372be152d36932b67
diff --git a/java/com/google/gerrit/server/index/change/ChangeField.java b/java/com/google/gerrit/server/index/change/ChangeField.java
index 2045dba..8e443f82 100644
--- a/java/com/google/gerrit/server/index/change/ChangeField.java
+++ b/java/com/google/gerrit/server/index/change/ChangeField.java
@@ -504,9 +504,9 @@
           ATTENTION_SET_FULL_FIELD.storedOnly(ChangeQueryBuilder.FIELD_ATTENTION_SET_FULL);
 
   /** The user assigned to the change. */
+  // The getter always returns NO_ASSIGNEE, since assignee field is deprecated.
   public static final IndexedField<ChangeData, Integer> ASSIGNEE_FIELD =
-      IndexedField.<ChangeData>integerBuilder("Assignee")
-          .build(changeGetter(c -> c.getAssignee() != null ? c.getAssignee().get() : NO_ASSIGNEE));
+      IndexedField.<ChangeData>integerBuilder("Assignee").build(changeGetter(c -> NO_ASSIGNEE));
 
   public static final IndexedField<ChangeData, Integer>.SearchSpec ASSIGNEE_SPEC =
       ASSIGNEE_FIELD.integer(ChangeQueryBuilder.FIELD_ASSIGNEE);
diff --git a/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java b/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java
index 895c4d8..6ddf7a3 100644
--- a/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java
+++ b/java/com/google/gerrit/server/index/change/ChangeSchemaDefinitions.java
@@ -232,12 +232,21 @@
           .build();
 
   /** Add prefixsubject field. */
+  @Deprecated
   static final Schema<ChangeData> V81 =
       new Schema.Builder<ChangeData>()
           .add(V80)
           .addSearchSpecs(ChangeField.PREFIX_SUBJECT_SPEC)
           .build();
 
+  /** Remove assignee field. */
+  static final Schema<ChangeData> V82 =
+      new Schema.Builder<ChangeData>()
+          .add(V81)
+          .remove(ChangeField.ASSIGNEE_SPEC)
+          .remove(ChangeField.ASSIGNEE_FIELD)
+          .build();
+
   /**
    * Name of the change index to be used when contacting index backends or loading configurations.
    */