Skip to content

Commit daad3c8

Browse files
committed
fix: migliora l'installazione inserendo il drop delle tabelle problematiche all'interno di un blocco try-catch
1 parent f2dfffc commit daad3c8

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

update/2_8.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,33 @@
145145
$id = $dbo->lastInsertedId();
146146
$dbo->query('UPDATE `zz_files` SET `id_category` = '.$id.' WHERE `category` = '.prepare($categoria));
147147
}
148-
$dbo->query('ALTER TABLE `zz_files` DROP `category`');
148+
$dbo->query('ALTER TABLE `zz_files` DROP `category`');
149+
150+
151+
// Rimozione delle foreign key dalla tabella my_impianti_marche_lang
152+
try {
153+
$dbo->query('ALTER TABLE `my_impianti_marche_lang` DROP FOREIGN KEY `my_impianti_marche_lang_ibfk_1`');
154+
} catch (Exception $e) {
155+
// Log dell'errore senza interrompere l'esecuzione
156+
error_log("Errore rimozione foreign key my_impianti_marche_lang_ibfk_1: " . $e->getMessage());
157+
}
158+
try {
159+
$dbo->query('ALTER TABLE `my_impianti_marche_lang` DROP FOREIGN KEY `my_impianti_marche_lang_ibfk_2`');
160+
} catch (Exception $e) {
161+
// Log dell'errore senza interrompere l'esecuzione
162+
error_log("Errore rimozione foreign key my_impianti_marche_lang_ibfk_2: " . $e->getMessage());
163+
}
164+
165+
// Rimozione delle tabelle my_impianti_marche_lang e my_impianti_marche
166+
try {
167+
$dbo->query('DROP TABLE `my_impianti_marche_lang`');
168+
} catch (Exception $e) {
169+
// Log dell'errore senza interrompere l'esecuzione
170+
error_log("Errore rimozione tabella my_impianti_marche_lang: " . $e->getMessage());
171+
}
172+
try {
173+
$dbo->query('DROP TABLE `my_impianti_marche`');
174+
} catch (Exception $e) {
175+
// Log dell'errore senza interrompere l'esecuzione
176+
error_log("Errore rimozione tabella my_impianti_marche: " . $e->getMessage());
177+
}

update/2_8.sql

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,6 @@ DELETE FROM `zz_modules` WHERE `name` = 'Marche impianti';
328328

329329
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `zz_marche` WHERE 1=1 AND parent = 0 HAVING 2=2 ORDER BY `zz_marche`.`name`' WHERE `zz_modules`.`name` = 'Marche';
330330

331-
ALTER TABLE `my_impianti_marche_lang` DROP FOREIGN KEY `my_impianti_marche_lang_ibfk_1`;
332-
ALTER TABLE `my_impianti_marche_lang` DROP FOREIGN KEY `my_impianti_marche_lang_ibfk_2`;
333-
334-
DROP TABLE `my_impianti_marche`;
335-
DROP TABLE `my_impianti_marche_lang`;
336-
337331
-- Allineamento vista Impianti
338332
UPDATE `zz_modules` SET `options` = "
339333
SELECT

0 commit comments

Comments
 (0)