Remove ApprovalCategory and ApprovalCategoryValue
These can be completely specified in the project config hierarchy and the database tables are no longer required. Also remove the size limit on patch_set_approvals.category_id, so new PatchSetApprovals can refer to label names rather than IDs. Migrate existing labels into project.config in All-Projects. When migrating, also convert existing PatchSetApprovals to refer to label names rather than IDs. Label IDs are still written to PatchSetApprovals and still supported in project.config. As of this change, update all code to match PatchSetApproval's categoryId on either label ID or name. This allows for the possibility of database migration without downtime (e.g. for gerrit-review.googlesource.com). The default schema migration code, however, does not include label IDs in project.config, since this schema migration is only intended to run offline. Change-Id: I5df6f0c5665d0ae4ee6b5e2944f5954fa2f96b5c
This commit is contained in:
@@ -32,10 +32,10 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.ApprovalCategory;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval.LabelId;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountCache;
|
||||
@@ -274,8 +274,8 @@ public class PostReviewers implements RestModifyView<ChangeResource, Input> {
|
||||
|
||||
private PatchSetApproval dummyApproval(ChangeControl ctl,
|
||||
PatchSet.Id patchSetId, Account.Id reviewerId) {
|
||||
ApprovalCategory.Id id = new ApprovalCategory.Id(
|
||||
Iterables.getLast(ctl.getLabelTypes().getLabelTypes()).getId());
|
||||
LabelId id =
|
||||
Iterables.getLast(ctl.getLabelTypes().getLabelTypes()).getLabelId();
|
||||
PatchSetApproval dummyApproval = new PatchSetApproval(
|
||||
new PatchSetApproval.Key(patchSetId, reviewerId, id), (short) 0);
|
||||
dummyApproval.cache(ctl.getChange());
|
||||
|
Reference in New Issue
Block a user