﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15033	sqlindexes doesn't create indexes for ForeignKeys on normal ManyToManyFields	Craig de Stigter	nobody	"[http://code.djangoproject.com/ticket/2350#comment:6 this comment] implies that the !ForeignKeys created by ManyToManyField tables should also have indexes (makes sense, right? Otherwise we'll have to always create them with custom SQL, or define a through relation every time, gross.)

However sqlindexes doesn't create the indexes. It does create the (from, to) unique constraints, but that's actually not very useful for many queries...

The fix is to change [http://code.djangoproject.com/browser/django/trunk/django/core/management/sql.py#L140 django/core/management/sql.py#L140]:

{{{
for model in models.get_models(app):
}}}

to:

{{{
for model in models.get_models(app, include_auto_created=True):
}}}

Tested in 1.2.4 and trunk (r15153)."	Bug	closed	Database layer (models, ORM)	1.2	Normal	duplicate			Accepted	1	1	0	0	0	0
