[Django]-Django migrate ProgrammingError: syntax error at or near ""

2👍

✅

Going off the other comments and my own experience . . . when you get this error, go into your migrations folder and delete everything except the __init__.py. You can even delete the __pycache__ folder. Then run makemigrations and migrate again. I think that should fix the problem.

0👍

This can also happen when making a CharField nullable if you do not specify max_length.

So the solution is to specify max_length in your model, then remove and remake the problematic migration..

This was described as a bug here.

0👍

This is old, but I will answer anyway.

The problem is that you made a "makemigrations" with a mistake in your model and that was catalogued, I will assume you corrected the mistake, that catalogue is not deleted, instead it was aggregated when you tried Migration.

What you need to do is delete everything in your migration folder except init, that should clear that up, if it doesn’t then you still have a mistake in your Model

Leave a comment