From 5157aaa092d313e9e0ede9481fe66937806df8bf Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Nov 2022 19:44:59 -0300 Subject: [PATCH] Bug 24860: DBIC schema Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/ItemGroup.pm | 34 +++++++++++++++++++++++++++-- Koha/Schema/Result/OldReserve.pm | 34 +++++++++++++++++++++++++++-- Koha/Schema/Result/Reserve.pm | 34 +++++++++++++++++++++++++++-- Koha/Schema/Result/TmpHoldsqueue.pm | 20 +++++++++++++++-- 4 files changed, 114 insertions(+), 8 deletions(-) diff --git a/Koha/Schema/Result/ItemGroup.pm b/Koha/Schema/Result/ItemGroup.pm index 9e4bf7b04b..ce1f9e0ef7 100644 --- a/Koha/Schema/Result/ItemGroup.pm +++ b/Koha/Schema/Result/ItemGroup.pm @@ -147,9 +147,39 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 old_reserves -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-02 16:18:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YO7VdfzHDqBjGHt7vQX7gw +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "old_reserves", + "Koha::Schema::Result::OldReserve", + { "foreign.item_group_id" => "self.item_group_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 reserves + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "reserves", + "Koha::Schema::Result::Reserve", + { "foreign.item_group_id" => "self.item_group_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-04 22:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:q2LTnircvx4khvkVm9eIsQ sub koha_objects_class { 'Koha::Biblio::ItemGroups'; diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm index 96c7373c16..729ccbd0b1 100644 --- a/Koha/Schema/Result/OldReserve.pm +++ b/Koha/Schema/Result/OldReserve.pm @@ -54,6 +54,14 @@ the date the hold was places foreign key from the biblio table defining which bib record this hold is on +=head2 item_group_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +foreign key from the item_groups table defining if this is an item group level hold + =head2 branchcode data_type: 'varchar' @@ -226,6 +234,8 @@ __PACKAGE__->add_columns( { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "biblionumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "item_group_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "branchcode", { data_type => "varchar", is_nullable => 1, size => 10 }, "desk_id", @@ -336,6 +346,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 item_group + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item_group", + "Koha::Schema::Result::ItemGroup", + { item_group_id => "item_group_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "SET NULL", + }, +); + =head2 itemnumber Type: belongs_to @@ -377,8 +407,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-28 20:08:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A3iHpf4nDeIpPsapNzdv8w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-04 22:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zoepd1m+pi6dEnOlhWttQQ __PACKAGE__->belongs_to( "item", diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 08aac12c2e..be67f43543 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -57,6 +57,14 @@ the date the hold was placed foreign key from the biblio table defining which bib record this hold is on +=head2 item_group_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +foreign key from the item_groups table defining if this is an item group level hold + =head2 branchcode data_type: 'varchar' @@ -235,6 +243,8 @@ __PACKAGE__->add_columns( is_foreign_key => 1, is_nullable => 0, }, + "item_group_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "branchcode", { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, "desk_id", @@ -385,6 +395,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 item_group + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item_group", + "Koha::Schema::Result::ItemGroup", + { item_group_id => "item_group_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -426,8 +456,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-22 17:37:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kYRPPeoVo0WMk1gH+qmi/w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-04 22:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vYS5THhVu6Sox6Luz4EJbg __PACKAGE__->belongs_to( "item", diff --git a/Koha/Schema/Result/TmpHoldsqueue.pm b/Koha/Schema/Result/TmpHoldsqueue.pm index 1c14d69a30..756c9325e4 100644 --- a/Koha/Schema/Result/TmpHoldsqueue.pm +++ b/Koha/Schema/Result/TmpHoldsqueue.pm @@ -108,6 +108,15 @@ __PACKAGE__->table("tmp_holdsqueue"); default_value: 0 is_nullable: 0 +=head2 timestamp + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +date and time this entry as added/last updated + =cut __PACKAGE__->add_columns( @@ -141,6 +150,13 @@ __PACKAGE__->add_columns( { data_type => "mediumtext", is_nullable => 1 }, "item_level_request", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "timestamp", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, ); =head1 RELATIONS @@ -201,8 +217,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-20 12:00:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ytvFiixR/AIAgTV/5sewcQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-04 22:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RdIrLi+vbzj3ab/UP7e9pw # You can replace this text with custom content, and it will be preserved on regeneration -- 2.39.5