Fix issues with setting and removing unique_together in one transaction.

Review Request #6141 — Created July 24, 2014 and submitted

Information

Django Evolution
master
bf04ab5...

Reviewers

The code for generating unique_together indexes failed to set a valid
name, which was fine so long as that index wasn't being set twice in the
same transaction.

With this bug, setting a unique_together and then changing it would
result in the SQL for index creation happening more than once.

It also didn't filter out no-op index creation/removals, which was
actually a problem for Postgres.

Now, we do a better job of filtering out unnecessary index operations
and also dealing with indexes that were created within that transaction.

Unit tests pass.

I hit this problem in production. This patch fixed it.

Description From Last Updated

local variable 'qn' is assigned to but never used

reviewbotreviewbot

local variable 'qn' is assigned to but never used

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/db/common.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/db/postgresql.py
        django_evolution/tests/test_unique_together.py
        django_evolution/mutators.py
        django_evolution/tests/db/mysql.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/db/common.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/db/postgresql.py
        django_evolution/tests/test_unique_together.py
        django_evolution/mutators.py
        django_evolution/tests/db/mysql.py
    
    
  2. django_evolution/db/common.py (Diff revision 1)
     
     
     local variable 'qn' is assigned to but never used
    
  3. django_evolution/db/common.py (Diff revision 1)
     
     
     local variable 'qn' is assigned to but never used
    
  4. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...