@echo off
REM Patrol System Database Migration
REM Executes the SQL migration to create patrol tables

echo.
echo ==================================================
echo SSCI Patrol System - Database Migration
echo ==================================================
echo.

cd /d C:\xampp\htdocs\ssci

REM Execute the migration PHP script
php -r "error_reporting(E_ALL); require_once 'config/bootstrap.php'; $db = $GLOBALS['db']; $sql = file_get_contents('database/migrations/010_create_patrol_system.sql'); $statements = array_filter(array_map('trim', explode(';', $sql))); $executed = 0; $errors = []; foreach ($statements as $statement) { if (empty($statement)) continue; try { $db->query($statement); echo \"✓ Executed statement\n\"; $executed++; } catch (Exception $e) { echo \"✗ Error: \" . $e->getMessage() . \"\n\"; $errors[] = $e->getMessage(); } } echo \"\n\"; echo \"Executed: $executed statements\n\"; if (!empty($errors)) { echo \"Errors: \" . count($errors) . \"\n\"; } echo \"\nMigration complete!\n\";"

echo.
pause
