Currently, when trying to migrate a django-jsonfield-compat migration backwards, the post_migrate signal handler crashes, because the schema query returns no result:
Traceback (most recent call last):
…
File "…/jsonfield_compat/convert.py", line 48, in handler_convert_json_fields
convert_model_json_fields(model)
File "…/jsonfield_compat/convert.py", line 43, in convert_model_json_fields
convert_column_to_json(model, column_name)
File "…/jsonfield_compat/convert.py", line 23, in convert_column_to_json
current_type = cursor.fetchone()[0].upper()
TypeError: 'NoneType' object is not subscriptable
I ran into this while trying to unapply django-activity-stream's migrations.
This changes the code above to handle a None result, and skip the conversion in that case.
Coverage increased (+1.2%) to 100.0% when pulling b4b5f85cf83a537487bed9a2a104e56765c89998 on pjdelport:fix-backward-migration into 5c7e967e863698683ba7999014b5cd6c80a56cf5 on kbussell:master.
Currently, when trying to migrate a django-jsonfield-compat migration backwards, the
post_migrate
signal handler crashes, because the schema query returns no result:I ran into this while trying to unapply django-activity-stream's migrations.
This changes the code above to handle a
None
result, and skip the conversion in that case.