From e24961b09b02292e0f764ca4d5dc14038081d495 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 19 Oct 2022 11:29:43 +0000 Subject: [PATCH] Bug 32030: Add document to license - DB 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 | 10 ++++++---- installer/data/mysql/kohastructure.sql | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl index 7b781d19d2..108bbf0595 100755 --- a/installer/data/mysql/atomicupdate/erm.pl +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -168,11 +168,12 @@ return { }); } - unless ( TableExists('erm_agreement_documents') ) { + unless ( TableExists('erm_documents') ) { $dbh->do(q{ - CREATE TABLE `erm_agreement_documents` ( + CREATE TABLE `erm_documents` ( `document_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', - `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', + `agreement_id` INT(11) NULL COMMENT 'link to the agreement', + `license_id` INT(11) NULL COMMENT 'link to the agreement', `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file', `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file', `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file', @@ -181,7 +182,8 @@ return { `physical_location` VARCHAR(255) DEFAULT NULL COMMENT 'physical location of the document', `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document', `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship', - CONSTRAINT `erm_agreement_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY(`document_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 5d78453160..259d029b6e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2876,13 +2876,14 @@ CREATE TABLE `erm_agreement_relationships` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- --- Table structure for table `erm_agreement_documents` +-- Table structure for table `erm_documents` -- -DROP TABLE IF EXISTS `erm_agreement_documents`; -CREATE TABLE `erm_agreement_documents` ( +DROP TABLE IF EXISTS `erm_documents`; +CREATE TABLE `erm_documents` ( `document_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', - `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', + `agreement_id` INT(11) NULL COMMENT 'link to the agreement', + `license_id` INT(11) NULL COMMENT 'link to the license', `file_name` varchar(255) DEFAULT NULL COMMENT 'name of the file', `file_type` varchar(255) DEFAULT NULL COMMENT 'type of the file', `file_description` varchar(255) DEFAULT NULL COMMENT 'description of the file', @@ -2891,7 +2892,8 @@ CREATE TABLE `erm_agreement_documents` ( `physical_location` VARCHAR(255) DEFAULT NULL COMMENT 'physical location of the document', `uri` varchar(255) DEFAULT NULL COMMENT 'URI of the document', `notes` mediumtext DEFAULT NULL COMMENT 'notes about this relationship', - CONSTRAINT `erm_agreement_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `erm_documents_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `erm_documents_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY(`document_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.39.2