Skip to content

Commit 442e640

Browse files
committed
Update DeactivateAuthorization
1 parent 980177e commit 442e640

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

sa/sa.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,18 +561,22 @@ func (ssa *SQLStorageAuthority) DeactivateAuthorization2(ctx context.Context, re
561561
return nil, errIncompleteRequest
562562
}
563563

564-
_, err := ssa.dbMap.ExecContext(ctx,
565-
`UPDATE authz2 SET status = :deactivated WHERE id = :id and status IN (:valid,:pending)`,
566-
map[string]interface{}{
567-
"deactivated": statusUint(core.StatusDeactivated),
568-
"id": req.Id,
569-
"valid": statusUint(core.StatusValid),
570-
"pending": statusUint(core.StatusPending),
571-
},
564+
query := `UPDATE authz2 SET status = :deactivated WHERE id = :id and status IN (:valid,:pending)`
565+
if features.Get().WriteNewOrderSchema && looksLikeRandomID(req.Id, ssa.clk.Now()) {
566+
query = `UPDATE authorizations SET status = :deactivated WHERE id = :id and status IN (:valid,:pending)`
567+
}
568+
569+
_, err := ssa.dbMap.ExecContext(ctx, query, map[string]interface{}{
570+
"deactivated": statusUint(core.StatusDeactivated),
571+
"id": req.Id,
572+
"valid": statusUint(core.StatusValid),
573+
"pending": statusUint(core.StatusPending),
574+
},
572575
)
573576
if err != nil {
574577
return nil, err
575578
}
579+
576580
return &emptypb.Empty{}, nil
577581
}
578582

0 commit comments

Comments
 (0)