From b5465a2b883ed66eac82cec8fa7ada585680b4e5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Mar 2022 17:48:04 +0100 Subject: [PATCH] Bug 32030: ERM - Users - DB table erm_agreement_users Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/erm.pl | 24 ++++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 13 +++++++++++++ 2 files changed, 37 insertions(+) diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl index 5d4b336404..a8d2940579 100755 --- a/installer/data/mysql/atomicupdate/erm.pl +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -69,5 +69,29 @@ return { ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; }); } + + unless ( TableExists('erm_agreement_user_roles') ) { + $dbh->do(q{ + CREATE TABLE `erm_agreement_user_roles` ( + `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', + `user_id` INT(11) NOT NULL COMMENT 'link to the user', + `role` VARCHAR(80) NOT NULL COMMENT 'role of the user', + CONSTRAINT `erm_agreement_users_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `erm_agreement_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + $dbh->do(q{ + INSERT IGNORE INTO authorised_value_categories (category_name, is_system) + VALUES + ('ERM_AGREEMENT_USER_ROLES', 1) + }); + $dbh->do(q{ + INSERT IGNORE INTO authorised_values (category, authorised_value, lib) + VALUES + ('ERM_AGREEMENT_USER_ROLES', 'librarian', 'ERM librarian'), + ('ERM_AGREEMENT_USER_ROLES', 'subject_specialist', 'Subject specialist') + }); + }, }; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e9c2cfaaf2..046a4b4dcc 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2809,6 +2809,19 @@ CREATE TABLE `erm_agreement_periods` ( PRIMARY KEY(`agreement_period_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `erm_agreement_user_roles` +-- + +DROP TABLE IF EXISTS `erm_agreement_user_roles`; +CREATE TABLE `erm_agreement_user_roles` ( + `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', + `user_id` INT(11) NOT NULL COMMENT 'link to the user', + `role` VARCHAR(80) NOT NULL COMMENT 'role of the user', + CONSTRAINT `erm_agreement_users_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `erm_agreement_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `export_format` -- -- 2.39.5