I agree - #24082 is unrelated since it's PostgresSQL and text field specific, presumably resulting from:
https://github.com/django/django/blob/8eb56f3c786b4dd7f78a60145ae2e483e24b62c1/django/db/backends/postgresql/schema.py#L34-L48The issue in this thread is specific to the interaction between unique_together and a ForeignKey, where unless an explicit `db_index=False` is set on the foreign key, Django creates a redundant index (under MySQL at least, haven't checked the others). However this appears fixed on master - I thought originally it might have been inadvertently fixed by this refactor:
https://github.com/django/django/commit/6bf7964023487f2a352084e74aca27aecb354d6c...but that commit was backported to 1.10.x, and this reproduces on Django 1.10.3 so it can't be. (If anyone wanted to try and bisect, a reduced testcase is here:
https://emorley.pastebin.mozilla.org/8933048)
As mentioned below, the workaround is to add an explicit `db_index=False` to the `ForeignKey`, however if that's done to an existing `ForeignKey`, the migration actually drops and recreates the constraint rather than just dropping the index, which is pretty bad since the latter is an performed as an online DDL operation with InnoDB, whereas adding a constraint is not. As such, I've filed:
https://code.djangoproject.com/ticket/27558Best wishes,
Ed