Django migration stuck Django migration stuck postgresql postgresql

Django migration stuck


For the community, the issue was django_migrations table was not updated with 0002_auto_20150707_1459 even though the migration was actually applied on table as mentioned in the post.

The solution was to insert a new row in django_migrations table with data like below so migration 0002 was skipped.

INSERT INTO DJANGO_MGRATIONS ('app', 'name', 'applied') VALUES ('appname', '0002_auto_20150707_1459', '2015-07-07 00:00')

Skipping migration must be done with extreme caution, hence check all details before skipping.


Same trouble happend, but without any logs

  1. At first I determined what app was a problem, by running
python manage.py migrate app_name

for every django app

  1. after that I check migrations for app by running
python manage.py showmigrations app_name
  1. And marked first uncompleted migration as completed by running
python manage.py migrate --fake app_name migration_name

※ about fake

And that was a solution in my case


For anyone finding this post: I just helped a coworker debug a similar problem (same error message), and in this case the source of the problem was trying to give the DateField a default value of u"" (which is of course invalid for a date) instead of None.

Actually part of the fun was that the previous migration (which created the model) already had this wrong default but still ran seamlessly, the error only appearing when trying to alter the field in any way.

The fix required editing the previous migration to set the sane default value, since Django uses the previous migration's schema description to get the previous default value.