Bug 32030: ERM - Periods - DB table erm_agreement_periods

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-03-07 14:31:54 +01:00 committed by Tomas Cohen Arazi
parent d3909882c9
commit 6f6fcdfdf6
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 31 additions and 0 deletions

View File

@ -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;
});
}
},
};

View File

@ -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`
--