Solve Django migration problem

Kindly follow these steps:

  • Delete all migration files
  • Truncate the django_migrations table
  • comment the new boolean field
  • run python manage.py makemigrations
  • run python manage.py migrate --fake
  • Uncomment the boolean field
  • run python manage.py makemigrations
  • run python manage.py migrate

Generally these steps solve any kind of migration problem

An another reason can be if you are using django_rest_framework then the serialiser too needs to be updated as per your model change.

Source: https://stackoverflow.com/a/51881452/6396981

AM

Written by Agus Makmun Author

SDE Lead working across the whole stack: backend, frontend, databases and the infrastructure that ships them. These days mostly infrastructure and Next.js, like moving apps off Vercel and Supabase to self-hosted.

arrow_backPrevious post How to create database Amazon RDS
search esc