Skip to content

Instantly share code, notes, and snippets.

@mhsamiei
Forked from mhipo1364/merge_migration.md
Created August 2, 2020 06:50
Show Gist options
  • Save mhsamiei/713ab6004a13f087951f826f0b0e6d08 to your computer and use it in GitHub Desktop.
Save mhsamiei/713ab6004a13f087951f826f0b0e6d08 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