From c29f0ec1fe9ef4f72d1ceee917f27c26220ef262 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 May 2022 18:15:53 +0200 Subject: [PATCH] Bug 32030: ERM - Agreement documents - 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 | 19 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl index ecaf4366ad..b164cb3b7d 100755 --- a/installer/data/mysql/atomicupdate/erm.pl +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -164,5 +164,24 @@ return { ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; }); } + + unless ( TableExists('erm_agreement_documents') ) { + $dbh->do(q{ + CREATE TABLE `erm_agreement_documents` ( + `document_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `agreement_id` INT(11) NOT 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', + `file_content` longblob DEFAULT NULL COMMENT 'the content of the file', + `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached', + `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, + 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 25e81c9a1c..adaab982fb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2871,6 +2871,26 @@ CREATE TABLE `erm_agreement_relationships` ( PRIMARY KEY(`agreement_id`, `related_agreement_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `erm_agreement_documents` +-- + +DROP TABLE IF EXISTS `erm_agreement_documents`; +CREATE TABLE `erm_agreement_documents` ( + `document_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `agreement_id` INT(11) NOT 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', + `file_content` longblob DEFAULT NULL COMMENT 'the content of the file', + `uploaded_on` datetime DEFAULT NULL COMMENT 'datetime when the file as attached', + `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, + PRIMARY KEY(`document_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `export_format` -- -- 2.39.5