Files
claim-guard-be/docker/scripts/reset-db.bat
2025-08-22 19:34:54 +07:00

44 lines
1.1 KiB
Batchfile

@echo off
REM =====================================================
REM Reset PostgreSQL Database (Windows)
REM =====================================================
echo 🗑️ Resetting PostgreSQL database...
REM Stop services
docker-compose down
REM Remove volumes (this will delete all data!)
echo ⚠️ WARNING: This will delete ALL database data!
set /p confirm=Are you sure? (y/N):
if /i not "%confirm%"=="y" (
echo ❌ Operation cancelled
exit /b 1
)
docker-compose down -v
docker volume rm claim-guard-be_postgres_data 2>nul
docker volume rm claim-guard-be_pgadmin_data 2>nul
echo ✅ Database reset complete!
echo 🐳 Starting fresh database...
REM Start database again
docker-compose up -d postgres
echo ⏳ Waiting for PostgreSQL to be ready...
REM Wait for PostgreSQL to be healthy
:wait_loop
docker-compose exec postgres pg_isready -U postgres -d claim_guard >nul 2>&1
if %errorlevel% neq 0 (
echo ⏳ PostgreSQL is unavailable - sleeping
timeout /t 2 /nobreak >nul
goto wait_loop
)
echo ✅ Fresh database is ready!
echo 📊 Run 'npx prisma migrate deploy' to setup schema
pause