1010-- is populated only if an error occurs during finalization and the order moves
1111-- to the "invalid" state; errors during validation are reflected elsewhere.
1212CREATE TABLE `orders2 ` (
13- ` id` bigint (20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
13+ ` id` bigint (20 ) UNSIGNED NOT NULL ,
1414 ` registrationID` bigint (20 ) UNSIGNED NOT NULL ,
1515 ` created` datetime NOT NULL ,
1616 ` expires` datetime NOT NULL ,
@@ -30,7 +30,7 @@ CREATE TABLE `orders2` (
3030-- "valid" or "invalid", and the validations column will be updated to point
3131-- to a new row in the validations table containing the record of that attempt.
3232CREATE TABLE `authorizations ` (
33- ` id` bigint (20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
33+ ` id` bigint (20 ) UNSIGNED NOT NULL ,
3434 ` registrationID` bigint (20 ) UNSIGNED NOT NULL ,
3535 ` identifierType` tinyint (4 ) NOT NULL ,
3636 ` identifierValue` varchar (255 ) NOT NULL ,
@@ -42,7 +42,6 @@ CREATE TABLE `authorizations` (
4242 ` status` tinyint (4 ) NOT NULL ,
4343 ` validations` json DEFAULT NULL ,
4444 PRIMARY KEY (` id` ),
45- KEY ` regID_identifier_status_expires_idx` (` registrationID` ,` identifierValue` ,` status` ,` expires` ,` identifierType` ),
4645) ENGINE= InnoDB DEFAULT CHARSET= utf8mb4
4746 PARTITION BY RANGE(id)
4847(PARTITION p_start VALUES LESS THAN (MAXVALUE));
@@ -52,7 +51,7 @@ CREATE TABLE `authorizations` (
5251-- including the validation method used, the resulting status (valid or
5352-- invalid), and an opaque blob of our audit record.
5453CREATE TABLE `validations ` (
55- ` id` bigint (20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
54+ ` id` bigint (20 ) UNSIGNED NOT NULL ,
5655 ` registrationID` bigint (20 ) UNSIGNED NOT NULL ,
5756 ` challenge` tinyint (4 ) NOT NULL ,
5857 ` attemptedAt` datetime NOT NULL ,
@@ -63,9 +62,20 @@ CREATE TABLE `validations` (
6362 PARTITION BY RANGE(id)
6463(PARTITION p_start VALUES LESS THAN (MAXVALUE));
6564
65+ -- The authzReuse table exists solely to allow cheap lookups of reusable authz
66+ -- IDs. This allos us to not have expensive indices on the authorizations table.
67+ CREATE TABLE `authzReuse ` (
68+ ` accountID_identifier` VARCHAR (300 ) NOT NULL ,
69+ ` authzID` VARCHAR (255 ) NOT NULL ,
70+ ` expires` DATETIME NOT NULL
71+ ) ENGINE= InnoDB DEFAULT CHARSET= utf8mb4
72+ PARTITION BY RANGE(id)
73+ (PARTITION p_start VALUES LESS THAN (MAXVALUE));
74+
6675-- +migrate Down
6776-- SQL section 'Down' is executed when this migration is rolled back
6877
78+ DROP TABLE ` authzReuse` ;
6979DROP TABLE ` validations` ;
7080DROP TABLE ` authorizations` ;
7181DROP TABLE ` orders2` ;
0 commit comments