Search Change-Id strings using ChangeIndex
Move the legacy Change.Id value to _id field and implement change_id field as the Change-Id string, taking advantage of the existing PREFIX support added for commit. Change-Id: I94b924f14474fb2d364819b9950ba3e85a2b2db9
This commit is contained in:
@@ -44,11 +44,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeField {
|
||||
/** Increment whenever making schema changes. */
|
||||
public static final int SCHEMA_VERSION = 6;
|
||||
public static final int SCHEMA_VERSION = 7;
|
||||
|
||||
/** Legacy change ID. */
|
||||
public static final FieldDef<ChangeData, Integer> CHANGE_ID =
|
||||
new FieldDef.Single<ChangeData, Integer>(ChangeQueryBuilder.FIELD_CHANGE,
|
||||
public static final FieldDef<ChangeData, Integer> LEGACY_ID =
|
||||
new FieldDef.Single<ChangeData, Integer>("_id",
|
||||
FieldType.INTEGER, true) {
|
||||
@Override
|
||||
public Integer get(ChangeData input, FillArgs args) {
|
||||
@@ -56,6 +56,17 @@ public class ChangeField {
|
||||
}
|
||||
};
|
||||
|
||||
/** Newer style Change-Id key. */
|
||||
public static final FieldDef<ChangeData, String> ID =
|
||||
new FieldDef.Single<ChangeData, String>("change_id",
|
||||
FieldType.PREFIX, true) {
|
||||
@Override
|
||||
public String get(ChangeData input, FillArgs args)
|
||||
throws OrmException {
|
||||
return input.change(args.db).getKey().get();
|
||||
}
|
||||
};
|
||||
|
||||
/** Change status string, in the same format as {@code status:}. */
|
||||
public static final FieldDef<ChangeData, String> STATUS =
|
||||
new FieldDef.Single<ChangeData, String>(ChangeQueryBuilder.FIELD_STATUS,
|
||||
|
||||
Reference in New Issue
Block a user