Skip to content

Instantly share code, notes, and snippets.

@felipe3dfx
Last active October 16, 2024 15:51
Show Gist options
  • Save felipe3dfx/ea37e038301e17ab335c742d07eff882 to your computer and use it in GitHub Desktop.
Save felipe3dfx/ea37e038301e17ab335c742d07eff882 to your computer and use it in GitHub Desktop.
Reset django migrations
1. Remove old migrations file
sudo find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "./.venv/*" -delete
sudo find . -path "*/migrations/*.pyc" -not -path "./.venv/*" -delete
2. Make migrations again
python manage.py makemigrations
3. Truncate django_migrations table
TRUNCATE TABLE django_migrations;
4. Migrate with fake
python manage.py migrate --fake
5. reload services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment