Skip to content

Instantly share code, notes, and snippets.

@mhipo1364
Created August 3, 2016 21:54
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save mhipo1364/a55da230e1ec80bfab70e9650637bb15 to your computer and use it in GitHub Desktop.
Save mhipo1364/a55da230e1ec80bfab70e9650637bb15 to your computer and use it in GitHub Desktop.
Re-Generate(Merge) Migration Files In Django

Re-Generate Migration

To merge exist migration files into one file:

  • Remove django_migration records table (manually)
  • Remove all migration files
  • run python manage.py migrate --fake command
  • run python manage.py makemigrations command
  • run python manage.py migrate --fake-initial command
  • run python manage.py migrate contenttypes command
  • and finally, for chacking if everything is just fine, run python manage.py migrate command

Now, check django_migration table and make sure all new files added in this table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment