[FIX] migrate-isms runner: strip commenti --in coda riga (un commento conteneva ';')
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
99bca920cb
commit
9964b2b73c
@@ -31,11 +31,17 @@ foreach ($files as $file) {
|
||||
}
|
||||
$sql = (string) file_get_contents($file);
|
||||
|
||||
// Rimuove le righe di commento "--" (le migrazioni non usano stringhe con '--').
|
||||
// Rimuove i commenti "--" (riga intera E in coda alla riga): un commento puo
|
||||
// contenere ';' (es. "-- NULL=sempre; cloud") e spezzerebbe lo split. Le
|
||||
// migrazioni non usano '--' dentro stringhe/valori, quindi e sicuro.
|
||||
$lines = preg_split('/\r?\n/', $sql);
|
||||
$clean = [];
|
||||
foreach ($lines as $l) {
|
||||
if (preg_match('/^\s*--/', $l)) {
|
||||
$pos = strpos($l, '--');
|
||||
if ($pos !== false) {
|
||||
$l = substr($l, 0, $pos);
|
||||
}
|
||||
if (trim($l) === '') {
|
||||
continue;
|
||||
}
|
||||
$clean[] = $l;
|
||||
|
||||
Reference in New Issue
Block a user