fix: broken SQL in update manifests — line-by-line instead of complete statements
build-update.ps1 was reading SQL migrations line-by-line, causing multi-line CREATE TABLE/INSERT statements to be stored as fragments in manifests. Fixed to strip comments, join lines, and split by semicolons. Fixed ver_0.324_manifest.json with correct SQL statements. Added try-catch in UpdateRepository to prevent fatal crashes on SQL errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -172,13 +172,19 @@ class UpdateRepository
|
||||
|
||||
foreach ( $manifest['sql'] as $query ) {
|
||||
$query = trim( $query );
|
||||
if ( $query !== '' ) {
|
||||
if ( $query === '' || strpos( $query, '--' ) === 0 ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if ( $this->db->query( $query ) ) {
|
||||
$success++;
|
||||
} else {
|
||||
$errors++;
|
||||
$log[] = '[WARNING] Błąd SQL: ' . $query;
|
||||
}
|
||||
} catch ( \Exception $e ) {
|
||||
$errors++;
|
||||
$log[] = '[WARNING] Wyjątek SQL: ' . $e->getMessage() . ' | Query: ' . substr( $query, 0, 200 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user