$s !== ''); echo "== " . basename($file) . " (" . count($statements) . " statement) ==\n"; foreach ($statements as $stmt) { try { $pdo->exec($stmt); $totalStmts++; } catch (PDOException $e) { $head = substr(preg_replace('/\s+/', ' ', $stmt), 0, 80); fwrite(STDERR, "[ERRORE] su \"$head...\": " . $e->getMessage() . "\n"); exit(1); } } } // Verifica rapida: la tabella org_roles esiste e ha le colonne attese. $cols = $pdo->query("SHOW COLUMNS FROM org_roles")->fetchAll(PDO::FETCH_COLUMN, 0); $expected = ['id','organization_id','role_name','parent_role_id','holder_user_id','is_governance_body','description','sort_order','created_by','created_at','updated_at']; $missing = array_diff($expected, $cols); echo "\n[OK] Eseguiti $totalStmts statement.\n"; echo "[OK] org_roles colonne: " . implode(', ', $cols) . "\n"; if ($missing) { fwrite(STDERR, "[ATTENZIONE] colonne mancanti: " . implode(', ', $missing) . "\n"); exit(1); } echo "[OK] org_roles pronta (organigramma A4 Fase 4.1).\n";