-
-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
56 additions
and
47 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
sa/_db-next/migrations/20210308140000_SimplePartitioning.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
-- +goose Up | ||
-- SQL in section 'Up' is executed when this migration is applied | ||
|
||
ALTER TABLE authz2 DROP INDEX IF EXISTS token; | ||
ALTER TABLE authz2 PARTITION BY RANGE(id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE certificates DROP FOREIGN KEY IF EXISTS regId_certificates; | ||
ALTER TABLE certificates DROP INDEX IF EXISTS serial, ADD INDEX serial (serial); | ||
ALTER TABLE certificates PARTITION BY RANGE(id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE fqdnSets DROP INDEX IF EXISTS serial, ADD INDEX serial (serial); | ||
ALTER TABLE fqdnSets PARTITION BY RANGE(id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE issuedNames PARTITION BY RANGE(id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE orderFqdnSets DROP FOREIGN KEY IF EXISTS orderFqdnSets_orderID_orders; | ||
ALTER TABLE orderFqdnSets DROP FOREIGN KEY IF EXISTS orderFqdnSets_registrationID_registrations; | ||
ALTER TABLE orderFqdnSets PARTITION BY RANGE (id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE orderToAuthz2 PARTITION BY RANGE COLUMNS(orderID, authzID) ( | ||
PARTITION p_start VALUES LESS THAN (MAXVALUE, MAXVALUE)); | ||
|
||
-- Must be before orders, to remove the foreign key before partitioning orders. | ||
ALTER TABLE requestedNames DROP FOREIGN KEY IF EXISTS orderID_orders; | ||
ALTER TABLE requestedNames PARTITION BY RANGE (id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE orders PARTITION BY RANGE (id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
ALTER TABLE precertificates DROP FOREIGN KEY IF EXISTS regId_precertificates; | ||
ALTER TABLE precertificates DROP INDEX IF EXISTS serial, ADD INDEX serial (serial); | ||
ALTER TABLE precertificates PARTITION BY RANGE(id) ( | ||
PARTITION p_start VALUES LESS THAN MAXVALUE); | ||
|
||
-- +goose Down | ||
-- SQL section 'Down' is executed when this migration is rolled back | ||
|
||
ALTER TABLE authz2 REMOVE PARTITIONING; | ||
ALTER TABLE certificates REMOVE PARTITIONING; | ||
ALTER TABLE fqdnSets REMOVE PARTITIONING; | ||
ALTER TABLE issuedNames REMOVE PARTITIONING; | ||
ALTER TABLE orderFqdnSets REMOVE PARTITIONING; | ||
ALTER TABLE orderToAuthz2 REMOVE PARTITIONING; | ||
ALTER TABLE orders REMOVE PARTITIONING; | ||
ALTER TABLE precertificates REMOVE PARTITIONING; | ||
ALTER TABLE requestedNames REMOVE PARTITIONING; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters