Bug 32030: ERM - Users - DB table erm_agreement_users

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-03-07 17:48:04 +01:00 committed by Tomas Cohen Arazi
parent e1224f9b9b
commit b5465a2b88
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 37 additions and 0 deletions

View file

@ -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')
});
},
};

View file

@ -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`
--