@echo off
echo ========================================
echo Apply Database Migrations
echo ========================================
echo.

cd ..\src\PowderCoating.Web

echo WARNING: This will modify your database!
echo Database: PowderCoatingDb on .\SQLEXPRESS
echo.
set /p confirm="Continue? (Y/N): "
if /i not "%confirm%"=="Y" (
    echo Cancelled.
    pause
    exit /b
)

echo.
echo Applying migrations...
dotnet ef database update --project ..\PowderCoating.Infrastructure

if %ERRORLEVEL% EQU 0 (
    echo.
    echo ========================================
    echo SUCCESS: Migrations applied
    echo ========================================
) else (
    echo.
    echo ========================================
    echo ERROR: Migration failed
    echo ========================================
)

echo.
pause
