• 
      
    Fish Trophy

    chipx86 got a fish trophy!

    Fish Trophy

    Add smarter support for grabbing the latest Version for a database.

    Review Request #7777 — Created Nov. 23, 2015 and submitted

    Information

    Django Evolution
    release-0.7.x

    Reviewers

    Historically, django-evolution was using Version.objects.latest() to
    grab the latest version of the database schema. However, this was
    failing in the event that you had two Version entries created within the
    same second on a database that didn't have very good precision on
    date/time fields (MySQL). This easily happened when both computing a
    baseline for new models and then trying to perform very simple and fast
    schema updates.

    We now have a new function, current_version(), which does the same thing
    that latest() did, but with the addition of factoring in the ordering of
    the IDs. In the event that two timestamps match, the newer ID will now
    take precedence, ensuring we're not looking at the "older" baseline
    entry.

    Unit tests pass.

    Simulated the original problem we've seen on a database here. Verified
    the same failure conditions (using an outdated schema, resulting in
    "fields have changed" errors) with the old implementation. Saw the correct
    results with the new one.

    Description From Last Updated

    local variable 'version1' is assigned to but never used

    reviewbotreviewbot

    Typo: "latet" -> "latest"

    AD adriano

    Col: 80 E501 line too long (85 > 79 characters)

    reviewbotreviewbot
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          django_evolution/evolve.py
          django_evolution/tests/test_evolution_models.py
          django_evolution/management/__init__.py
          django_evolution/management/commands/evolve.py
          django_evolution/models.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          django_evolution/evolve.py
          django_evolution/tests/test_evolution_models.py
          django_evolution/management/__init__.py
          django_evolution/management/commands/evolve.py
          django_evolution/models.py
      
      
    2. Show all issues
       local variable 'version1' is assigned to but never used
      
    3. 
        
    chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          django_evolution/evolve.py
          django_evolution/tests/test_evolution_models.py
          django_evolution/management/__init__.py
          django_evolution/management/commands/evolve.py
          django_evolution/models.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          django_evolution/evolve.py
          django_evolution/tests/test_evolution_models.py
          django_evolution/management/__init__.py
          django_evolution/management/commands/evolve.py
          django_evolution/models.py
      
      
    2. Show all issues
      Col: 80
       E501 line too long (85 > 79 characters)
      
    3. 
        
    david
    1. Ship It!
    2. 
        
    AD
    1. 
        
    2. django_evolution/models.py (Diff revision 2)
       
       
      Show all issues

      Typo: "latet" -> "latest"

    3. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-0.7.x (f71fc88)