diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl index 2e8d047593..ecaf4366ad 100755 --- a/installer/data/mysql/atomicupdate/erm.pl +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -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; + }); + } }, }; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 1a0cc55e3a..25e81c9a1c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -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` --