Bug 32030: ERM - License - DB

fix atomic

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-05-03 15:03:18 +02:00 committed by Tomas Cohen Arazi
parent 2adaddeea4
commit 36cd32d14c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
3 changed files with 54 additions and 2 deletions

View file

@ -93,5 +93,30 @@ return {
('ERM_AGREEMENT_USER_ROLES', 'subject_specialist', 'Subject specialist')
});
unless ( TableExists('erm_agreement_licenses') ) {
$dbh->do(q{
CREATE TABLE `erm_agreement_licenses` (
`agreement_license_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
`status` VARCHAR(80) NOT NULL COMMENT 'current status of the license',
`controlling` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'is a controlling license',
`physical_location` VARCHAR(80) NOT NULL COMMENT 'physical location of the license',
`notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
`uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY(`agreement_license_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
$dbh->do(q{
INSERT IGNORE INTO authorised_values (category, authorised_value, lib)
VALUES
('ERM_AGREEMENT_LICENSE_STATUS', 'controlling', 'Controlling'),
('ERM_AGREEMENT_LICENSE_STATUS', 'future', 'Future'),
('ERM_AGREEMENT_LICENSE_STATUS', 'history', 'Historic'),
('ERM_AGREEMENT_LICENSE_LOCATION', 'filing_cabinet', 'Filing cabinet'),
('ERM_AGREEMENT_LICENSE_LOCATION', 'filing_cabinet', 'Cupboard');
});
},
};

View file

@ -2822,6 +2822,23 @@ CREATE TABLE `erm_agreement_user_roles` (
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 `erm_agreement_licenses`
--
DROP TABLE IF EXISTS `erm_agreement_licenses`;
CREATE TABLE `erm_agreement_licenses` (
`agreement_license_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
`status` VARCHAR(80) NOT NULL COMMENT 'current status of the license',
`controlling` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'is a controlling license',
`physical_location` VARCHAR(80) NOT NULL COMMENT 'physical location of the license',
`notes` mediumtext DEFAULT NULL COMMENT 'notes about this license',
`uri` varchar(255) DEFAULT NULL COMMENT 'URI of the license',
CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY(`agreement_license_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `export_format`
--

View file

@ -79,7 +79,12 @@ VALUES
('ERM_AGREEMENT_STATUS', 1),
('ERM_AGREEMENT_CLOSURE_REASON', 1),
('ERM_AGREEMENT_RENEWAL_PRIORITY', 1),
('ERM_AGREEMENT_USER_ROLES', 1);
('ERM_AGREEMENT_USER_ROLES', 1),
('ERM_LICENSE_TYPE', 1),
('ERM_LICENSE_STATUS', 1),
('ERM_AGREEMENT_LICENSE_STATUS', 1),
('ERM_AGREEMENT_LICENSE_LOCATION', 1);
INSERT IGNORE INTO authorised_values (category, authorised_value, lib)
VALUES
('ERM_AGREEMENT_STATUS', 'active', 'Active'),
@ -91,4 +96,9 @@ VALUES
('ERM_AGREEMENT_RENEWAL_PRIORITY', 'renew', 'Renew'),
('ERM_AGREEMENT_RENEWAL_PRIORITY', 'cancel', 'Cancel'),
('ERM_AGREEMENT_USER_ROLES', 'librarian', 'ERM librarian'),
('ERM_AGREEMENT_USER_ROLES', 'subject_specialist', 'Subject specialist');
('ERM_AGREEMENT_USER_ROLES', 'subject_specialist', 'Subject specialist'),
('ERM_AGREEMENT_LICENSE_STATUS', 'controlling', 'Controlling'),
('ERM_AGREEMENT_LICENSE_STATUS', 'future', 'Future'),
('ERM_AGREEMENT_LICENSE_STATUS', 'history', 'Historic'),
('ERM_AGREEMENT_LICENSE_LOCATION', 'filing_cabinet', 'Filing cabinet'),
('ERM_AGREEMENT_LICENSE_LOCATION', 'cupboard', 'Cupboard');