From 6f6fcdfdf6677e329b2d9c0d3fb1ed018e5d0a7a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Mar 2022 14:31:54 +0100 Subject: [PATCH] Bug 32030: ERM - Periods - DB table erm_agreement_periods 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 | 15 +++++++++++++++ installer/data/mysql/kohastructure.sql | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl index d10bc0baa5..5d4b336404 100755 --- a/installer/data/mysql/atomicupdate/erm.pl +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -54,5 +54,20 @@ return { ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'renew', 'Renew'), ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'cancel', 'Cancel') }); + + unless ( TableExists('erm_agreement_periods') ) { + $dbh->do(q{ + CREATE TABLE `erm_agreement_periods` ( + `agreement_period_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', + `started_on` DATE NOT NULL COMMENT 'start of the agreement period', + `ended_on` DATE COMMENT 'end of the agreement period', + `cancellation_deadline` DATE DEFAULT NULL COMMENT 'Deadline for the cancellation', + `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period', + CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + PRIMARY KEY(`agreement_period_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 ab7c59ed77..e9c2cfaaf2 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2793,6 +2793,22 @@ CREATE TABLE `erm_agreements` ( PRIMARY KEY(`agreement_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `erm_agreement_periods` +-- + +DROP TABLE IF EXISTS `erm_agreement_periods`; +CREATE TABLE `erm_agreement_periods` ( + `agreement_period_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `agreement_id` INT(11) NOT NULL COMMENT 'link to the agreement', + `started_on` DATE NOT NULL COMMENT 'start of the agreement period', + `ended_on` DATE COMMENT 'end of the agreement period', + `cancellation_deadline` DATE DEFAULT NULL COMMENT 'Deadline for the cancellation', + `notes` mediumtext DEFAULT NULL COMMENT 'notes about this period', + CONSTRAINT `erm_agreement_periods_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE, + PRIMARY KEY(`agreement_period_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `export_format` -- -- 2.39.5