Add support for Django 1.5's index_together property.

Review Request #5121 — Created Dec. 16, 2013 and submitted

Information

Django Evolution
master

Reviewers

Add support for Django 1.5's index_together property.

Django 1.5 introduced index_together for creating an index that spans
columns without being unique. This provides support for that new
property through ChangeMeta.

Unlike with unique_together, we don't have old signature state to worry
about, so we can safely compare values and assume they're correct
(though the actual code to perform the index_together will still
sanity-check the database before generating error-prone SQL).

Unit tests pass.

Tested that it doesn't cause any issues with our existing evolutions.

Description From Last Updated

This indentation is very, very weird. How about: self.changed\ .setdefault(app_name, {})\ .setdefault('changed', {})\ .setdefault(model_name, {})\ .setdefault('meta_changed', [])\ .append('index_together')

daviddavid
chipx86
david
  1. 
      
  2. django_evolution/diff.py (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    This indentation is very, very weird.

    How about:

    self.changed\
        .setdefault(app_name, {})\
        .setdefault('changed', {})\
        .setdefault(model_name, {})\
        .setdefault('meta_changed', [])\
        .append('index_together')
    
    1. Not wild about the backslashes. I think it actually looks less readable.

      That said, I hate the current form too. It's used in a lot of places in this codebase. I planned to fix it in a separate change in one swoop. Basically, going to add a function that takes each part of that path as *args and loop through, doing the setdefault. Given that, going to drop this for now, and I'll put a new change up shortly.

  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...