Skip to content

Commit

Permalink
fix(storage): mysql migrate failure webauthn (#6866)
Browse files Browse the repository at this point in the history
This fixes an issue with MySQL / MariaDB which fails to upgrade the v12 schema version when webauthn_devices has entries.

Fixes #6859
  • Loading branch information
james-d-elliott committed Mar 15, 2024
1 parent 65a7fc2 commit 60cae67
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
CALL PROC_DROP_INDEX('webauthn_credentials', 'webauthn_credentials_kid_key');
CALL PROC_DROP_INDEX('webauthn_credentials', 'webauthn_credentials_lookup_key');

CREATE TABLE IF NOT EXISTS webauthn_credentials (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand Down Expand Up @@ -25,7 +28,7 @@ CREATE UNIQUE INDEX webauthn_credentials_kid_key ON webauthn_credentials (kid);
CREATE UNIQUE INDEX webauthn_credentials_lookup_key ON webauthn_credentials (rpid, username, description);

INSERT INTO webauthn_credentials (created_at, last_used_at, rpid, username, description, kid, aaguid, attestation_type, attachment, transport, sign_count, clone_warning, legacy, discoverable, present, verified, backup_eligible, backup_state, public_key)
SELECT id, created_at, last_used_at, CAST(rpid AS CHAR) AS rpid, username, description, kid, aaguid, attestation_type, 'cross-platform', transport, sign_count, clone_warning, TRUE, FALSE, FALSE, FALSE, FALSE, public_key
SELECT created_at, last_used_at, CAST(rpid AS CHAR) AS rpid, username, description, kid, aaguid, attestation_type, 'cross-platform', transport, sign_count, clone_warning, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, public_key
FROM webauthn_devices;

DROP TABLE IF EXISTS webauthn_devices;
Expand Down

0 comments on commit 60cae67

Please sign in to comment.