Skip to content

Instantly share code, notes, and snippets.

@antibagr
Created November 14, 2020 04:04
Show Gist options
  • Save antibagr/3d399d404dc4b062c85dae89b6273292 to your computer and use it in GitHub Desktop.
Save antibagr/3d399d404dc4b062c85dae89b6273292 to your computer and use it in GitHub Desktop.
@echo off
:: ========================================
:: Easy way to make migrations on Django project
:: Replace YOUR_APP_NAME on line 13 with your actual Django app name
:: Made for fun by Rudolf Nemov
:: https://github.com/antibagr
echo Starting migration ...
set app_name=YOUR_APP_NAME
for /F "tokens=* USEBACKQ" %%F IN (`python manage.py makemigrations %app_name%`) DO (
SET migration_status=%%F
)
if /i "%migration_status:~0,2%"=="No" (
echo No changes detected in "%app_name%"
goto EOF
) else (
echo %migration_status%
python manage.py migrate
)
:EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment