load("declarationtva@declarationtva"); echo "

DeclarationTVA Database Migration

"; // Read the migration SQL file $migration_file = __DIR__ . '/sql/migration_add_documents_table.sql'; if (!file_exists($migration_file)) { die("Migration file not found: " . $migration_file); } $sql_content = file_get_contents($migration_file); $sql_statements = explode(';', $sql_content); $success_count = 0; $error_count = 0; foreach ($sql_statements as $sql) { $sql = trim($sql); if (empty($sql) || strpos($sql, '--') === 0) { continue; } echo "

Executing: " . htmlspecialchars(substr($sql, 0, 100)) . "...

"; $result = $db->query($sql); if ($result) { echo "

✓ Success

"; $success_count++; } else { echo "

✗ Error: " . htmlspecialchars($db->lasterror()) . "

"; $error_count++; } } echo "

Migration Summary

"; echo "

Successful statements: " . $success_count . "

"; echo "

Failed statements: " . $error_count . "

"; if ($error_count == 0) { echo "

Migration completed successfully!

"; } else { echo "

Migration completed with errors. Please check the error messages above.

"; } echo "

← Back to Declaration List

"; ?>