From 5bd5e774ce588035ee398bb602e3ed0a6758060a Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Sun, 10 Aug 2025 16:05:13 +0000 Subject: [PATCH] [DO NOT PUSH] Bug 39601: DBIC changes --- Koha/Schema/Result/Borrower.pm | 19 ++- Koha/Schema/Result/WebauthnCredential.pm | 168 +++++++++++++++++++++++ 2 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 Koha/Schema/Result/WebauthnCredential.pm diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 1e1fa11cd4..f5f1a43724 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -2146,6 +2146,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 webauthn_credentials + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "webauthn_credentials", + "Koha::Schema::Result::WebauthnCredential", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 basketnoes Type: many_to_many @@ -2197,8 +2212,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-10 07:11:31 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XFOe2X4k2DUziaNS5pWd/Q +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-10 16:01:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XImLyVPcmi4lIe7k2314Cg __PACKAGE__->belongs_to( "library", diff --git a/Koha/Schema/Result/WebauthnCredential.pm b/Koha/Schema/Result/WebauthnCredential.pm new file mode 100644 index 0000000000..baea3687f8 --- /dev/null +++ b/Koha/Schema/Result/WebauthnCredential.pm @@ -0,0 +1,168 @@ +use utf8; +package Koha::Schema::Result::WebauthnCredential; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::WebauthnCredential + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("webauthn_credentials"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 borrowernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 credential_id + + data_type: 'varbinary' + is_nullable: 0 + size: 255 + +=head2 public_key + + data_type: 'varbinary' + is_nullable: 0 + size: 1024 + +=head2 sign_count + + data_type: 'integer' + default_value: 0 + extra: {unsigned => 1} + is_nullable: 0 + +=head2 transports + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +=head2 nickname + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +=head2 created_on + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + default_value: 'current_timestamp()' + is_nullable: 0 + +=head2 last_used + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "borrowernumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "credential_id", + { data_type => "varbinary", is_nullable => 0, size => 255 }, + "public_key", + { data_type => "varbinary", is_nullable => 0, size => 1024 }, + "sign_count", + { + data_type => "integer", + default_value => 0, + extra => { unsigned => 1 }, + is_nullable => 0, + }, + "transports", + { data_type => "varchar", is_nullable => 1, size => 255 }, + "nickname", + { data_type => "varchar", is_nullable => 1, size => 255 }, + "created_on", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + default_value => "current_timestamp()", + is_nullable => 0, + }, + "last_used", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("credential_id", ["credential_id"]); + +=head1 RELATIONS + +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-10 16:01:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RYGHkNCeMvGQwrjVzFXU6Q + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.5