79301782

Date: 2024-12-22 21:46:02
Score: 0.5
Natty:
Report link

You can "manually" squash migrations, by

  1. clear migration history

    python manage.py migrate --fake myapp zero
    
  2. Remove the migration files

    rm django/myapp/migrations/*.py
    
  3. Make new migration files (there will only be one, this will make the new initial migration file)

    python manage.py makemigrations
    
  4. And migrate to it

    python manage.py migrate --fake-initial
    

The reason for --fake and --fake-initial are to prevent the database from being updated during this process.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Nils