django_evolution/compat/patches/django1_8__1_10_mysql_preserve_db_index.py (Diff revision 1)Show all issues
Review Request #11172 — Created Sept. 14, 2020 and submitted
The MySQL backend on Django 1.8 through 1.10 has a heavy-handed
workaround for some of its SQL generation around indexes. It tries to
disable setting indexes on a
ForeignKey, leaving that up to MySQL
itself, by setting
db_index = False. It claims this is "temporary,"
but it never restores the values. This impacts signatures of these
fields on these versions of Django (and breaks unit tests).
This patch preserves the list of fields that would have their values
reset and then restores
db_indexon each of them, allowing Django to
continue to avoid those indexes without breaking any future usage of
the flags on these fields.
MySQL unit tests pass on all supported versions of Django.
E999 SyntaxError: invalid syntax
Fixed a typo that snuck into the commit.
Revision 2 (+126)