-
Notifications
You must be signed in to change notification settings - Fork 978
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing indices and foreign keys
- Loading branch information
Showing
11 changed files
with
62 additions
and
23 deletions.
There are no files selected for viewing
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
5 changes: 0 additions & 5 deletions
5
...stence/sql/migrations/sql/20230705000000000002_cookie_flow_request_url.cockroach.down.sql
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
persistence/sql/migrations/sql/20230705000000000002_cookie_flow_request_url.down.sql
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...igrations/sql/20240221000000000000_identity_recovery_codes_flow_id_idx.cockroach.down.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,5 @@ | ||
DROP INDEX IF EXISTS identity_login_codes@identity_login_codes_identity_id_idx; | ||
DROP INDEX IF EXISTS identity_login_codes@identity_login_codes_flow_id_idx; | ||
DROP INDEX IF EXISTS identity_recovery_codes@identity_recovery_codes_flow_id_idx; | ||
DROP INDEX IF EXISTS identity_registration_codes@identity_registration_codes_flow_id_idx; | ||
DROP INDEX IF EXISTS identity_verification_codes@identity_verification_codes_flow_id_idx; |
5 changes: 5 additions & 0 deletions
5
...ence/sql/migrations/sql/20240221000000000000_identity_recovery_codes_flow_id_idx.down.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,5 @@ | ||
DROP INDEX IF EXISTS identity_login_codes.identity_login_codes_identity_id_idx; | ||
DROP INDEX IF EXISTS identity_login_codes.identity_login_codes_flow_id_idx; | ||
DROP INDEX IF EXISTS identity_recovery_codes.identity_recovery_codes_flow_id_idx; | ||
DROP INDEX IF EXISTS identity_registration_codes.identity_registration_codes_flow_id_idx; | ||
DROP INDEX IF EXISTS identity_verification_codes.identity_verification_codes_flow_id_idx; |
6 changes: 6 additions & 0 deletions
6
...ql/migrations/sql/20240221000000000000_identity_recovery_codes_flow_id_idx.mysql.down.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,6 @@ | ||
ALTER TABLE `identity_recovery_codes` | ||
DROP FOREIGN KEY `identity_recovery_codes_identity_id_fk`, | ||
ADD CONSTRAINT `identity_recovery_tokens_identity_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; | ||
|
||
ALTER TABLE `identity_login_codes` | ||
DROP FOREIGN KEY `identity_login_codes_identity_id_fk`; |
16 changes: 16 additions & 0 deletions
16
.../sql/migrations/sql/20240221000000000000_identity_recovery_codes_flow_id_idx.mysql.up.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,16 @@ | ||
-- This FK was previously misnamed. | ||
ALTER TABLE `identity_recovery_codes` | ||
DROP FOREIGN KEY `identity_recovery_tokens_identity_id_fk`, | ||
ADD CONSTRAINT `identity_recovery_codes_identity_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; | ||
|
||
-- Missing FK | ||
ALTER TABLE `identity_login_codes` | ||
ADD CONSTRAINT `identity_login_codes_identity_id_fk` FOREIGN KEY (`identity_id`) REFERENCES `identities` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; | ||
|
||
-- MySQL has created the remaining indices automatically together with the foreign key constraints. | ||
|
||
-- CREATE INDEX identity_login_codes_identity_id_idx ON identity_login_codes (identity_id ASC); | ||
-- CREATE INDEX identity_login_codes_flow_id_idx ON identity_login_codes (selfservice_login_flow_id ASC); | ||
-- CREATE INDEX identity_registration_codes_flow_id_idx ON identity_registration_codes (selfservice_registration_flow_id ASC); | ||
-- CREATE INDEX identity_recovery_codes_flow_id_idx ON identity_recovery_codes (selfservice_recovery_flow_id ASC); | ||
-- CREATE INDEX identity_verification_codes_flow_id_idx ON identity_verification_codes (selfservice_verification_flow_id ASC); |
5 changes: 5 additions & 0 deletions
5
...sql/migrations/sql/20240221000000000000_identity_recovery_codes_flow_id_idx.sqlite.up.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,5 @@ | ||
CREATE INDEX IF NOT EXISTS identity_login_codes_identity_id_idx ON identity_login_codes (identity_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_login_codes_flow_id_idx ON identity_login_codes (selfservice_login_flow_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_registration_codes_flow_id_idx ON identity_registration_codes (selfservice_registration_flow_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_recovery_codes_flow_id_idx ON identity_recovery_codes (selfservice_recovery_flow_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_verification_codes_flow_id_idx ON identity_verification_codes (selfservice_verification_flow_id ASC); |
8 changes: 8 additions & 0 deletions
8
...stence/sql/migrations/sql/20240221000000000000_identity_recovery_codes_flow_id_idx.up.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,8 @@ | ||
ALTER TABLE identity_login_codes | ||
ADD CONSTRAINT identity_login_codes_identity_id_fk FOREIGN KEY (identity_id) REFERENCES identities (id) ON DELETE CASCADE ON UPDATE RESTRICT; | ||
|
||
CREATE INDEX IF NOT EXISTS identity_login_codes_identity_id_idx ON identity_login_codes (identity_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_login_codes_flow_id_idx ON identity_login_codes (selfservice_login_flow_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_registration_codes_flow_id_idx ON identity_registration_codes (selfservice_registration_flow_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_recovery_codes_flow_id_idx ON identity_recovery_codes (selfservice_recovery_flow_id ASC); | ||
CREATE INDEX IF NOT EXISTS identity_verification_codes_flow_id_idx ON identity_verification_codes (selfservice_verification_flow_id ASC); |