· 8 years ago · May 07, 2018, 09:04 AM
1#!/bin/sh
2
3#remove migrations files if you are in projectroot/scripts
4find .. -path "*/migrations/*.py" -not -name "__init__.py" -delete
5find .. -path "*/migrations/*.pyc" -delete
6
7#delete records from migrations table
8psql -d mydatabase -c 'delete from django_migrations;'
9
10#create migrations again
11python manage_local.py makemigrations
12
13#Using Django 1.11 > update_contenttypes no longer exists
14python manage_local.py migrate --fake contenttypes
15
16#simulates table creation
17python manage_local.py migrate --fake-initial