Bug 32030: Add document to license - DB

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:
Pedro Amorim 2022-10-19 11:29:43 +00:00 committed by Tomas Cohen Arazi
parent 7a81358ad7
commit e24961b09b
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 13 additions and 9 deletions

View file

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

View file

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