Prevent attempting to create/delete indexes unnecessarily.

Review Request #7164 — Created April 4, 2015 and submitted

Information

Django Evolution
master
7190ba0...

Reviewers

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.

Description From Last Updated

'AddField' imported but unused

reviewbotreviewbot

'add_index_to_database_sig' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/tests/db/postgresql.py
        django_evolution/db/common.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/test_change_field.py
        django_evolution/tests/db/mysql.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/tests/db/postgresql.py
        django_evolution/db/common.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/test_change_field.py
        django_evolution/tests/db/mysql.py
    
    
  2. Show all issues
     'AddField' imported but unused
    
  3. Show all issues
     'add_index_to_database_sig' imported but unused
    
  4. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/tests/db/postgresql.py
        django_evolution/db/common.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/test_change_field.py
        django_evolution/tests/db/mysql.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/tests/db/postgresql.py
        django_evolution/db/common.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/test_change_field.py
        django_evolution/tests/db/mysql.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (e03dc33)