From 47ca573c72a6e7449ee6b08ef2a80b2f439d8481 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 24 Apr 2023 20:38:16 +0200 Subject: [PATCH] Bug 30708: DO NOT PUSH - ONLY FOR DB UPDATE DURING TESTING STAGE Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: BULAC - http://www.bulac.fr/ Signed-off-by: Heather Hernandez Signed-off-by: Laurence Rault --- installer/data/mysql/atomicupdate/bug_30708.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/installer/data/mysql/atomicupdate/bug_30708.pl b/installer/data/mysql/atomicupdate/bug_30708.pl index 2f80c19c7b7..394fe5dacf4 100755 --- a/installer/data/mysql/atomicupdate/bug_30708.pl +++ b/installer/data/mysql/atomicupdate/bug_30708.pl @@ -109,5 +109,21 @@ return { say $out "Added new table 'preservation_processing_attributes_items'"; } + unless ( column_exists('preservation_processing_attributes_items', 'processing_attribute_item_id') ) { + $dbh->do(q{ + ALTER TABLE preservation_processing_attributes_items + DROP CONSTRAINT `preservation_processing_attributes_items_ibfk_1`, + DROP CONSTRAINT `preservation_processing_attributes_items_ibfk_2`, + DROP PRIMARY KEY, + ADD COLUMN `processing_attribute_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + ADD PRIMARY KEY(`processing_attribute_item_id`) + }); + $dbh->do(q{ + ALTER TABLE preservation_processing_attributes_items + ADD CONSTRAINT `preservation_processing_attributes_items_ibfk_1` FOREIGN KEY (`processing_attribute_id`) REFERENCES `preservation_processing_attributes` (`processing_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `preservation_processing_attributes_items_ibfk_2` FOREIGN KEY (`train_item_id`) REFERENCES `preservation_trains_items` (`train_item_id`) ON DELETE CASCADE ON UPDATE CASCADE + }); + } + }, }; -- 2.25.1