@@ -, +, @@ --- Koha/Schema/Result/Item.pm | 16 +++++------- Koha/Schema/Result/ItemGroupItem.pm | 26 +++---------------- .../atomicupdate/bug_24857_item_groups.pl | 4 +-- installer/data/mysql/kohastructure.sql | 4 +-- 4 files changed, 14 insertions(+), 36 deletions(-) --- a/Koha/Schema/Result/Item.pm +++ a/Koha/Schema/Result/Item.pm @@ -729,16 +729,16 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 item_group_items +=head2 item_group_item -Type: has_many +Type: might_have Related object: L =cut -__PACKAGE__->has_many( - "item_group_items", +__PACKAGE__->might_have( + "item_group_item", "Koha::Schema::Result::ItemGroupItem", { "foreign.item_id" => "self.itemnumber" }, { cascade_copy => 0, cascade_delete => 0 }, @@ -880,12 +880,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mLs4vLD2LsJGkBKZCZbXg -======= -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WG9AuZsBgTMEWjlfwFQdeA ->>>>>>> Bug 24857: Rename Volumes => Item groups (DB) +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:52:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WeRY0B6a1D94WckYmUgWpQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); --- a/Koha/Schema/Result/ItemGroupItem.pm +++ a/Koha/Schema/Result/ItemGroupItem.pm @@ -84,19 +84,17 @@ __PACKAGE__->set_primary_key("item_group_items_id"); =head1 UNIQUE CONSTRAINTS -=head2 C +=head2 C =over 4 -=item * L - =item * L =back =cut -__PACKAGE__->add_unique_constraint("item_group_id", ["item_group_id", "item_id"]); +__PACKAGE__->add_unique_constraint("item_id", ["item_id"]); =head1 RELATIONS @@ -131,24 +129,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zfCA4diZgiexDnY1rD6xkQ - -=head2 koha_object_class - -=cut - -sub koha_object_class { - 'Koha::Biblio::Volume::Item'; -} - -=head2 koha_objects_class - -=cut -======= -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UkFl9MLWlH8wy3T/AaVIdQ ->>>>>>> Bug 24857: Rename Volumes => Item groups (DB):Koha/Schema/Result/ItemGroupItem.pm +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:52:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:y9cE5sPmUxcJFgAZfsEQsg sub koha_object_class { 'Koha::Biblio::ItemGroup::Item'; --- a/installer/data/mysql/atomicupdate/bug_24857_item_groups.pl +++ a/installer/data/mysql/atomicupdate/bug_24857_item_groups.pl @@ -39,9 +39,9 @@ use Modern::Perl; `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups", `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table", PRIMARY KEY (`item_group_items_id`), - UNIQUE KEY (item_group_id,item_id), + UNIQUE KEY (`item_id`), CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `item_group_items_vifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; }); } --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1833,9 +1833,9 @@ CREATE TABLE `item_group_items` ( `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups", `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table", PRIMARY KEY (`item_group_items_id`), - UNIQUE KEY (item_group_id,item_id), + UNIQUE KEY (`item_id`), CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `item_group_items_vifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- --