[Koha-bugs] [Bug 32030] Electronic resource management (ERM)
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Nov 9 09:39:51 CET 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32030
--- Comment #32 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
(In reply to Jonathan Druart from comment #31)
> TestBuilder.t is failing on ERM::User::Roles, it's missing a primary key on
> erm_user_roles I think
>
> Can be tested with:
>
> use t::lib::TestBuilder;
> my $builder = t::lib::TestBuilder->new;
> my $m = 'Koha::ERM::UserRoles';
> eval "require $m";
> my $object = $builder->build_object( { class => $m } );
> say ref($object);
>
> Should display "Koha::ERM::UserRole", not be empty
I confirm that the following changes fix the test:
ALTER TABLE erm_user_roles ADD COLUMN user_role_id int(11) NOT NULL
AUTO_INCREMENT PRIMARY KEY FIRST;
diff --git a/installer/data/mysql/kohastructure.sql
b/installer/data/mysql/kohastructure.sql
index 54ed708304a..33e2980576b 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2865,13 +2865,15 @@ CREATE TABLE `erm_agreement_periods` (
DROP TABLE IF EXISTS `erm_user_roles`;
CREATE TABLE `erm_user_roles` (
+ `user_role_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`agreement_id` INT(11) NULL COMMENT 'link to the agreement',
`license_id` INT(11) NULL COMMENT 'link to the license',
`user_id` INT(11) NOT NULL COMMENT 'link to the user',
`role` VARCHAR(80) NOT NULL COMMENT 'role of the user',
CONSTRAINT `erm_user_roles_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES
`erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `erm_user_roles_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES
`erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES
`borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `erm_user_roles_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES
`borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+ PRIMARY KEY(`user_role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Then `dbic`.
But the REST API spec and Vue part need to be adjusted.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list