From a1d5ad87d7e499357cf0de81aef87ca95d6ad741 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 12 Apr 2024 08:59:20 +0000 Subject: [PATCH] Bug 6796: DBIC schema update Signed-off-by: Katrin Fischer --- Koha/Schema/Result/Branch.pm | 19 +++++- Koha/Schema/Result/LibraryHour.pm | 105 ++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 Koha/Schema/Result/LibraryHour.pm diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 3a21ff7e1e..935cfe1972 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -800,6 +800,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 library_hours + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "library_hours", + "Koha::Schema::Result::LibraryHour", + { "foreign.library_id" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 library_smtp_server Type: might_have @@ -966,8 +981,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-04-05 06:44:56 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hNniM1Slml6YGmpEa3MJ1w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-04-12 08:58:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xp3Kem0f5nkl71jI4sbH3A __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/LibraryHour.pm b/Koha/Schema/Result/LibraryHour.pm new file mode 100644 index 0000000000..9c11cd6c55 --- /dev/null +++ b/Koha/Schema/Result/LibraryHour.pm @@ -0,0 +1,105 @@ +use utf8; +package Koha::Schema::Result::LibraryHour; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::LibraryHour + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("library_hours"); + +=head1 ACCESSORS + +=head2 library_id + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 day + + data_type: 'enum' + default_value: 0 + extra: {list => [0,1,2,3,4,5,6]} + is_nullable: 0 + +=head2 open_time + + data_type: 'time' + is_nullable: 1 + +=head2 close_time + + data_type: 'time' + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "library_id", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "day", + { + data_type => "enum", + default_value => 0, + extra => { list => [0 .. 6] }, + is_nullable => 0, + }, + "open_time", + { data_type => "time", is_nullable => 1 }, + "close_time", + { data_type => "time", is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("library_id", "day"); + +=head1 RELATIONS + +=head2 library + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "library", + "Koha::Schema::Result::Branch", + { branchcode => "library_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-04-12 08:58:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1W6KcIBKWaCCu/UEXF+zug + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.5