Skip to content

Instantly share code, notes, and snippets.

@clint74
Created April 2, 2019 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clint74/64151b174109f02e96634ae3d88152b5 to your computer and use it in GitHub Desktop.
Save clint74/64151b174109f02e96634ae3d88152b5 to your computer and use it in GitHub Desktop.
#!/bin/sh
#remove migrations files
find .. -path "*/migrations/*.py" -not -name "__init__.py" -delete
find .. -path "*/migrations/*.pyc" -delete
#delete records from migrations table
psql -d <nome_projeto> -c 'delete from django_migrations;'
#create migrations again
python manage.py makemigrations
#Using Django 1.11 > update_contenttypes no longer exists
python manage.py migrate --fake contenttypes
#simulates table creation
python manage.py migrate --fake-initial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment