In my case I was using a check in view.py to check if a there are any objects in a model. I wanted to delete unnecessary migrations and start from zero. But every time I ran makemigrations I get django.db.utils.OperationalError: no such table error. After removing the if models.Product.objects.exists() check from my view.py then I could run the makemigrations command.