Skip to content

Commit 04738b7

Browse files
committed
document schema changes between 2.1 and 2.2
1 parent 0c2b7cc commit 04738b7

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

UPGRADE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,20 @@ deployment at hand:
4242
minimum_certification_level = "0" means the authenticator model is not important
4343
and corresponds to request_tokenmodel = false. Every other setting will trigger
4444
behaviour matching the previous request_tokenmodel = true.
45+
46+
## Upgrade from 2.1.x to 2.2.x
47+
48+
There are minor schema changes. The following two columns MUST be added before
49+
upgrading:
50+
51+
ALTER TABLE credentials ADD COLUMN lastUsedTime TIMESTAMP DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP() AFTER `attLevel`;
52+
ALTER TABLE credentials ADD COLUMN lastUsedIp VARCHAR(64) DEFAULT NULL AFTER `lastUsedTime`;
53+
54+
For consistency with new deployments, the following changes SHOULD be executed
55+
to align table definitions to new deployments. The module will not break
56+
if the old definition remains in place, but you may encounter issue #76 then.
57+
58+
When using MySQL or MariaDB:
59+
60+
ALTER TABLE credentials MODIFY COLUMN credentialId varchar(1024) CHARACTER SET 'binary' NOT NULL;
61+

src/WebAuthn/Store/Database.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public function __construct(array $config)
8080
? "attLevel VARCHAR(6) NOT NULL DEFAULT 'None' CHECK (attLevel IN ('None','Basic','Self','AttCA')),"
8181
: "attLevel ENUM('None','Basic','Self','AttCA') NOT NULL DEFAULT 'None',")
8282
. "
83+
lastUsedTime TIMESTAMP DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(),
84+
lastUsedIp VARCHAR(64) DEFAULT NULL,
8385
CONSTRAINT credentials_user_id_credentialId_key UNIQUE (user_id, credentialId)
8486
)
8587
");

0 commit comments

Comments
 (0)