Prevent attempting to create/delete indexes unnecessarily.
Review Request #7164 — Created April 4, 2015 and submitted — Latest diff uploaded
If the db_index parameter was set to True and an index already existed in the databse, or it was set to False and an index didn't exist in the database, we'd still generate the SQL for the index change, leading to errors. We now do a better job of detecting whether we actually need to create/delete the index. Unit tests were added to ensure this works across databases.
Unit tests pass on all databases.
Solved a problem I was hitting with a real-world database.