Skip to content

Commit ff1547b

Browse files
committed
Update schema based on feedback
1 parent f56dfc0 commit ff1547b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sa/db-next/boulder_sa/20240801000000_OrderSchema.sql

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111
-- to the "invalid" state; errors during validation are reflected elsewhere.
1212
CREATE TABLE `orders2` (
1313
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
14-
`registrationID` bigint(20) NOT NULL,
14+
`registrationID` bigint(20) UNSIGNED NOT NULL,
1515
`created` datetime NOT NULL,
1616
`expires` datetime NOT NULL,
1717
`authorizations` json NOT NULL,
1818
`profile` varchar(255) NOT NULL,
19-
`status` tinyint(4) NOT NULL,
19+
`beganProcessing` boolean NOT NULL,
2020
`error` mediumblob DEFAULT NULL,
2121
`certificateSerial` varchar(255) DEFAULT NULL,
2222
PRIMARY KEY (`id`),
23-
KEY `reg_status_expires` (`registrationID`,`expires`),
24-
KEY `regID_created_idx` (`registrationID`,`created`)
2523
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
2624
PARTITION BY RANGE(id)
2725
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
@@ -33,7 +31,7 @@ CREATE TABLE `orders2` (
3331
-- to a new row in the validations table containing the record of that attempt.
3432
CREATE TABLE `authorizations` (
3533
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
36-
`registrationID` bigint(20) NOT NULL,
34+
`registrationID` bigint(20) UNSIGNED NOT NULL,
3735
`identifierType` tinyint(4) NOT NULL,
3836
`identifierValue` varchar(255) NOT NULL,
3937
`created` datetime NOT NULL,
@@ -44,22 +42,23 @@ CREATE TABLE `authorizations` (
4442
`status` tinyint(4) NOT NULL,
4543
`validations` json DEFAULT NULL,
4644
PRIMARY KEY (`id`),
47-
KEY `regID_expires_idx` (`registrationID`,`status`,`expires`),
48-
KEY `regID_identifier_status_expires_idx` (`registrationID`,`identifierType`,`identifierValue`,`status`,`expires`),
49-
KEY `expires_idx` (`expires`)
45+
KEY `regID_identifier_status_expires_idx` (`registrationID`,`identifierValue`,`status`,`expires`,`identifierType`),
5046
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
5147
PARTITION BY RANGE(id)
5248
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
5349

50+
5451
-- The validations table holds records of completed validation attempts,
5552
-- including the validation method used, the resulting status (valid or
5653
-- invalid), and an opaque blob of our audit record.
5754
CREATE TABLE `validations` (
5855
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
56+
`registrationID` bigint(20) UNSIGNED NOT NULL,
5957
`challenge` tinyint(4) NOT NULL,
6058
`attemptedAt` datetime NOT NULL,
6159
`status` tinyint(4) NOT NULL,
62-
`record` json DEFAULT NULL,
60+
`record` json NOT NULL,
61+
PRIMARY KEY (`id`),
6362
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
6463
PARTITION BY RANGE(id)
6564
(PARTITION p_start VALUES LESS THAN (MAXVALUE));

0 commit comments

Comments
 (0)