Skip to content

Commit

Permalink
fix: controllo database per campo assente
Browse files Browse the repository at this point in the history
  • Loading branch information
Pek5892 committed Nov 27, 2024
1 parent 67af574 commit 600b962
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions modules/aggiornamenti/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,16 @@ function settings_diff($expected, $current)
$query = 'Chiave mancante';
}
} else {
$query .= 'ALTER TABLE `'.$table.'` CHANGE `'.$name.'` `'.$name.'` '.$data[$table][$name]['type'];
$query .= 'ALTER TABLE `'.$table;

if (array_key_exists('current', $diff) && is_null($diff['current'])) {
$query .= '` ADD `'.$name.'`';
} else {
$query .= '` CHANGE `'.$name.'` `'.$name.'` ';
}

$query .= $data[$table][$name]['type'];;

if ($data[$table][$name]['null'] == 'NO') {
$null = 'NOT NULL';
} else {
Expand Down Expand Up @@ -257,7 +266,7 @@ function settings_diff($expected, $current)

if (array_key_exists('current', $errors) && $errors['current'] == null) {
echo '
<div class="alert alert-danger" ><i class="fa fa-times"></i> '.tr('Tabella assente').'
<div class="alert alert-danger" ><i class="fa fa-times"></i> '.tr('Tabella non prevista').'
</div>';
continue;
}
Expand Down

0 comments on commit 600b962

Please sign in to comment.