Skip to content

Commit 5be559d

Browse files
authored
sa: remove CertStatus.LockCol and SubscriberApproved. (letsencrypt#4175)
Both of these database fields are not being used.
1 parent e050820 commit 5be559d

File tree

6 files changed

+134
-128
lines changed

6 files changed

+134
-128
lines changed

cmd/expiration-mailer/main_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,13 @@ func addExpiringCerts(t *testing.T, ctx *testCtx) []core.Certificate {
386386
test.AssertNotError(t, err, "Couldn't add certC")
387387
err = setupDBMap.Insert(certD)
388388
test.AssertNotError(t, err, "Couldn't add certD")
389-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial1String, ctx.fc.Now().AddDate(0, 0, -3), string(core.OCSPStatusGood), rawCertA.NotAfter, time.Time{}, time.Time{}, 0, 0, false)
389+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial1String, ctx.fc.Now().AddDate(0, 0, -3), string(core.OCSPStatusGood), rawCertA.NotAfter, time.Time{}, time.Time{}, 0)
390390
test.AssertNotError(t, err, "Couldn't add certStatusA")
391-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial2String, ctx.fc.Now().Add(-36*time.Hour), string(core.OCSPStatusGood), rawCertB.NotAfter, time.Time{}, time.Time{}, 0, 0, false)
391+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial2String, ctx.fc.Now().Add(-36*time.Hour), string(core.OCSPStatusGood), rawCertB.NotAfter, time.Time{}, time.Time{}, 0)
392392
test.AssertNotError(t, err, "Couldn't add certStatusB")
393-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, notAfter, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial3String, string(core.OCSPStatusGood), rawCertC.NotAfter, time.Time{}, time.Time{}, time.Time{}, 0, 0, false)
393+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, notAfter, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial3String, string(core.OCSPStatusGood), rawCertC.NotAfter, time.Time{}, time.Time{}, time.Time{}, 0)
394394
test.AssertNotError(t, err, "Couldn't add certStatusC")
395-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, notAfter, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial4String, string(core.OCSPStatusGood), rawCertD.NotAfter, time.Time{}, time.Time{}, time.Time{}, 0, 0, false)
395+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, notAfter, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial4String, string(core.OCSPStatusGood), rawCertD.NotAfter, time.Time{}, time.Time{}, time.Time{}, 0)
396396
test.AssertNotError(t, err, "Couldn't add certStatusD")
397397
err = setupDBMap.Insert(fqdnStatusD)
398398
test.AssertNotError(t, err, "Couldn't add fqdnStatusD")
@@ -549,7 +549,7 @@ func TestCertIsRenewed(t *testing.T) {
549549

550550
err = setupDBMap.Insert(cert)
551551
test.AssertNotError(t, err, fmt.Sprintf("Couldn't add cert %s", testData.stringSerial))
552-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?)", fmt.Sprintf("%x", testData.Serial.Bytes()), string(core.OCSPStatusGood), time.Time{}, time.Time{}, time.Time{}, 0, 0, false)
552+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?)", fmt.Sprintf("%x", testData.Serial.Bytes()), string(core.OCSPStatusGood), time.Time{}, time.Time{}, time.Time{}, 0)
553553
test.AssertNotError(t, err, fmt.Sprintf("Couldn't add certStatus %s", testData.stringSerial))
554554
err = setupDBMap.Insert(fqdnStatus)
555555
test.AssertNotError(t, err, fmt.Sprintf("Couldn't add fqdnStatus %s", testData.stringSerial))
@@ -608,7 +608,7 @@ func TestLifetimeOfACert(t *testing.T) {
608608
test.AssertNotError(t, err, "sa.NewDbMap failed")
609609
err = setupDBMap.Insert(certA)
610610
test.AssertNotError(t, err, "unable to insert Certificate")
611-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, notAfter, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial1String, string(core.OCSPStatusGood), rawCertA.NotAfter, time.Time{}, time.Time{}, time.Time{}, 0, 0, false)
611+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, status, notAfter, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial1String, string(core.OCSPStatusGood), rawCertA.NotAfter, time.Time{}, time.Time{}, time.Time{}, 0)
612612
test.AssertNotError(t, err, "unable to insert CertificateStatus")
613613

614614
type lifeTest struct {
@@ -709,7 +709,7 @@ func TestDontFindRevokedCert(t *testing.T) {
709709
test.AssertNotError(t, err, "sa.NewDbMap failed")
710710
err = setupDBMap.Insert(certA)
711711
test.AssertNotError(t, err, "unable to insert Certificate")
712-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial,status, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?)", serial1String, string(core.OCSPStatusRevoked), time.Time{}, time.Time{}, time.Time{}, 0, 0, false)
712+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial,status, lastExpirationNagSent, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?)", serial1String, string(core.OCSPStatusRevoked), time.Time{}, time.Time{}, time.Time{}, 0)
713713
test.AssertNotError(t, err, "unable to insert CertificateStatus")
714714

715715
err = testCtx.m.findExpiringCertificates()
@@ -773,9 +773,9 @@ func TestDedupOnRegistration(t *testing.T) {
773773
test.AssertNotError(t, err, "Couldn't add certA")
774774
err = setupDBMap.Insert(certB)
775775
test.AssertNotError(t, err, "Couldn't add certB")
776-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial1String, time.Unix(0, 0), string(core.OCSPStatusGood), rawCertA.NotAfter, time.Time{}, time.Time{}, 0, 0, false)
776+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial1String, time.Unix(0, 0), string(core.OCSPStatusGood), rawCertA.NotAfter, time.Time{}, time.Time{}, 0)
777777
test.AssertNotError(t, err, "Couldn't add certStatusA")
778-
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason, LockCol, subscriberApproved) VALUES (?,?,?,?,?,?,?,?,?)", serial2String, time.Unix(0, 0), string(core.OCSPStatusGood), rawCertB.NotAfter, time.Time{}, time.Time{}, 0, 0, false)
778+
_, err = setupDBMap.Exec("INSERT INTO certificateStatus (serial, lastExpirationNagSent, status, notAfter, ocspLastUpdated, revokedDate, revokedReason) VALUES (?,?,?,?,?,?,?)", serial2String, time.Unix(0, 0), string(core.OCSPStatusGood), rawCertB.NotAfter, time.Time{}, time.Time{}, 0)
779779
test.AssertNotError(t, err, "Couldn't add certStatusB")
780780

781781
err = testCtx.m.findExpiringCertificates()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
-- +goose Up
3+
-- SQL in section 'Up' is executed when this migration is applied
4+
5+
ALTER TABLE `certificateStatus` DROP COLUMN `subscriberApproved`;
6+
7+
-- +goose Down
8+
-- SQL section 'Down' is executed when this migration is rolled back
9+
10+
ALTER TABLE `certificateStatus` ADD COLUMN `subscriberApproved` TINYINT(1) DEFAULT 0;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
-- +goose Up
3+
-- SQL in section 'Up' is executed when this migration is applied
4+
5+
ALTER TABLE `certificateStatus` DROP COLUMN `LockCol`;
6+
7+
-- +goose Down
8+
-- SQL section 'Down' is executed when this migration is rolled back
9+
10+
ALTER TABLE `certificateStatus` ADD COLUMN `LockCol` BIGINT(20) DEFAULT 0;

sa/model.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,6 @@ type certStatusModel struct {
180180
OCSPResponse []byte `db:"ocspResponse"`
181181
NotAfter time.Time `db:"notAfter"`
182182
IsExpired bool `db:"isExpired"`
183-
184-
// TODO(#856, #873): Deprecated, remove once #2882 has been deployed
185-
// to production
186-
SubscribedApproved bool `db:"subscriberApproved"`
187-
LockCol int
188183
}
189184

190185
// challModel is the description of a core.Challenge in the database

0 commit comments

Comments
 (0)