From b05f8f31ae9bc33ccd332112c1f9a2f10bc5d36e Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Sun, 10 Aug 2025 16:18:12 +0000 Subject: [PATCH] Bug 39601: Atomic update --- .../bug_39601_add_passkey_support.pl | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_39601_add_passkey_support.pl diff --git a/installer/data/mysql/atomicupdate/bug_39601_add_passkey_support.pl b/installer/data/mysql/atomicupdate/bug_39601_add_passkey_support.pl new file mode 100644 index 0000000000..6488550d09 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_39601_add_passkey_support.pl @@ -0,0 +1,36 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "39601", + description => "Add passkey support to Koha as an authentication mechanism ", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Create webauthn_credentials table + if ( !TableExists('webauthn_credentials') ) { + $dbh->do( + q{ + CREATE TABLE webauthn_credentials ( + id INT AUTO_INCREMENT PRIMARY KEY, + borrowernumber INT NOT NULL, + credential_id VARBINARY(255) NOT NULL, + public_key VARBINARY(1024) NOT NULL, + sign_count INT UNSIGNED NOT NULL DEFAULT 0, + transports VARCHAR(255) DEFAULT NULL, + nickname VARCHAR(255) DEFAULT NULL, + created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + last_used DATETIME DEFAULT NULL, + CONSTRAINT fk_webauthn_credentials_borrowernumber FOREIGN KEY (borrowernumber) + REFERENCES borrowers(borrowernumber) ON DELETE CASCADE, + UNIQUE KEY (credential_id) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + } + ); + say_success( $out, "Created table 'webauthn_credentials'" ); + } else { + say_info( $out, "Table 'webauthn_credentials' already exists!" ); + } + }, +}; -- 2.39.5