Bug 32030: ERM - related agreements - DB

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-12 18:05:24 +02:00 committed by Tomas Cohen Arazi
parent 72b73e0a5b
commit 54b95355fa
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 28 additions and 0 deletions

View File

@ -151,5 +151,18 @@ return {
('ERM_AGREEMENT_LICENSE_LOCATION', 'cupboard', 'Cupboard');
});
unless ( TableExists('erm_agreement_relationships') ) {
$dbh->do(q{
CREATE TABLE `erm_agreement_relationships` (
`agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
`related_agreement_id` INT(11) NOT NULL COMMENT 'link to the related agreement',
`relationship` ENUM('supersedes', 'is-superseded-by', 'provides_post-cancellation_access_for', 'has-post-cancellation-access-in', 'tracks_demand-driven_acquisitions_for', 'has-demand-driven-acquisitions-in', 'has_backfile_in', 'has_frontfile_in', 'related_to') NOT NULL COMMENT 'relationship between the two agreements',
`notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY(`agreement_id`, `related_agreement_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
},
};

View File

@ -2856,6 +2856,21 @@ CREATE TABLE `erm_agreement_licenses` (
PRIMARY KEY(`agreement_license_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `erm_agreement_relationships`
--
DROP TABLE IF EXISTS `erm_agreement_relationships`;
CREATE TABLE `erm_agreement_relationships` (
`agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement',
`related_agreement_id` INT(11) NOT NULL COMMENT 'link to the related agreement',
`relationship` ENUM('supersedes', 'is-superseded-by', 'provides_post-cancellation_access_for', 'has-post-cancellation-access-in', 'tracks_demand-driven_acquisitions_for', 'has-demand-driven-acquisitions-in', 'has_backfile_in', 'has_frontfile_in', 'related_to') NOT NULL COMMENT 'relationship between the two agreements',
`notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship',
CONSTRAINT `erm_agreement_relationships_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `erm_agreement_relationships_ibfk_2` FOREIGN KEY (`related_agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY(`agreement_id`, `related_agreement_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `export_format`
--