Upload via GUI (275 Dateien)

This commit is contained in:
2026-10-23 11:14:33 +00:00
parent 73bb587197
commit f216dbca1a
2 changed files with 24 additions and 1 deletions
+18
View File
@@ -1209,6 +1209,24 @@ function run_migrations(PDO $pdo, bool $verbose = false): array
}
}
// Migration 0043: Abteilungen können neue Tickets automatisch zuweisen (an einen Mitarbeiter oder reihum).
if (!isset($done['php_0043_department_auto_assign'])) {
try {
$has = function (string $col) use ($pdo): bool {
try { $pdo->query("SELECT $col FROM departments LIMIT 1"); return true; } catch (Throwable $e) { return false; }
};
if (!$has('auto_assign_mode')) $pdo->exec("ALTER TABLE departments ADD COLUMN auto_assign_mode VARCHAR(20) NOT NULL DEFAULT 'none'");
if (!$has('auto_assign_staff_id')) $pdo->exec('ALTER TABLE departments ADD COLUMN auto_assign_staff_id INT NULL');
if (!$has('auto_assign_last_id')) $pdo->exec('ALTER TABLE departments ADD COLUMN auto_assign_last_id INT NULL');
$pdo->prepare('INSERT INTO schema_migrations (migration) VALUES (?)')->execute(['php_0043_department_auto_assign']);
$result['applied']++;
if ($verbose) $result['log'][] = ' [OK] php_0043_department_auto_assign';
} catch (Throwable $e) {
$result['errors'][] = 'php_0043_department_auto_assign: ' . $e->getMessage();
if ($verbose) $result['log'][] = ' [FAIL] php_0043_department_auto_assign - ' . $e->getMessage();
}
}
return $result;
}