brand-master/apply-migration.bat
dvirlabs 9176e32e6f
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Fix image not load correcttlly
2026-05-08 18:07:46 +03:00

30 lines
929 B
Batchfile

@echo off
REM Apply database migration 005 - Add password reset fields
echo Getting database pod name...
for /f "delims=" %%i in ('kubectl get pod -n my-apps -l app.kubernetes.io/component=db -o jsonpath^="{.items[0].metadata.name}"') do set DB_POD=%%i
if "%DB_POD%"=="" (
echo ❌ Database pod not found
exit /b 1
)
echo 📦 Database pod: %DB_POD%
echo 📝 Applying migration 005_add_password_reset_fields.sql...
echo.
REM Copy migration file to pod
kubectl cp backend/migrations/005_add_password_reset_fields.sql my-apps/%DB_POD%:/tmp/migration.sql
REM Execute migration
kubectl exec -n my-apps %DB_POD% -- psql -U brand_master_user -d brand_master_db -f /tmp/migration.sql
echo.
echo ✅ Migration applied successfully!
echo.
echo 🔄 Restarting backend pod to pick up changes...
kubectl delete pod -n my-apps -l app.kubernetes.io/component=backend
echo.
echo ✅ Done! Backend will restart with updated schema.