Add schema evolution compatibility for Django 1.7, 1.8, and 1.9.

Review Request #8109 — Created April 8, 2016 and submitted

Information

Django Evolution
master
03a257b...

Reviewers

This updates the compatibility modules in Django Evolution to support
Django 1.7 through 1.9. These make use of the new Schema Editor
functionality introduced with Django 1.7's migration feature to generate
SQL equivalent to what these versions of Django would generate, helping
us to stay compatible in the future.

Not all of the Schema Editor support is public, and not all of the logic
we need is even accessible, so we are forced to access private functions
and re-implement logic here and there, but generally, it's pretty
reasonable.

Each of the newly-supported versions of Django generate SQL differently
from older versions, and differently from each other. In some cases,
these are enough where we have to actually compare against sample SQL
datasets specific to certain versions of Django.

This change is not sufficient to actually enable evolution for a
project. It just brings API compatibility. The work to make evolutions
and migrations work together will be a whole separate project.

Unit tests pass against Django 1.6, 1.7, 1.8, and 1.9 for SQLite,
MySQL, and Postgres.

Description From Last Updated

'get_model' imported but unused

reviewbotreviewbot

'get_models' imported but unused

reviewbotreviewbot

redefinition of unused 'OrderedDict' from line 20

reviewbotreviewbot

redefinition of unused 'all_models' from line 21

reviewbotreviewbot

'logging' imported but unused

reviewbotreviewbot

local variable 'e' is assigned to but never used

reviewbotreviewbot

local variable 'out_sql' is assigned to but never used

reviewbotreviewbot

'django' imported but unused

reviewbotreviewbot

'digest' imported but unused

reviewbotreviewbot

'supports_index_together' imported but unused

reviewbotreviewbot

local variable 'style' is assigned to but never used

reviewbotreviewbot

local variable 'creation' is assigned to but never used

reviewbotreviewbot

local variable 'creation' is assigned to but never used

reviewbotreviewbot

local variable 'style' is assigned to but never used

reviewbotreviewbot

local variable 'creation' is assigned to but never used

reviewbotreviewbot

local variable 'style' is assigned to but never used

reviewbotreviewbot

'get_model' imported but unused

reviewbotreviewbot

'Evolution' imported but unused

reviewbotreviewbot

'transaction' imported but unused

reviewbotreviewbot

'curry' imported but unused

reviewbotreviewbot

'clear_app_cache' imported but unused

reviewbotreviewbot

'apps' imported but unused

reviewbotreviewbot

'create_constraint_name' imported but unused

reviewbotreviewbot

'create_index_together_name' imported but unused

reviewbotreviewbot

There should be two blank lines between these.

brenniebrennie

This blank line shouldn't be here.

daviddavid

How about from django.utils.six.moves.cPickle import loads, dumps ?

daviddavid

undefined name 'ImproperlyConfigured'

reviewbotreviewbot

undefined name 'ImproperlyConfigured'

reviewbotreviewbot

local variable 'e' is assigned to but never used

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
  2. django_evolution/compat/apps.py (Diff revision 1)
     
     
    Show all issues
     'get_model' imported but unused
    
  3. django_evolution/compat/apps.py (Diff revision 1)
     
     
    Show all issues
     'get_models' imported but unused
    
  4. django_evolution/compat/apps.py (Diff revision 1)
     
     
    Show all issues
     redefinition of unused 'OrderedDict' from line 20
    
  5. django_evolution/compat/apps.py (Diff revision 1)
     
     
    Show all issues
     redefinition of unused 'all_models' from line 21
    
  6. django_evolution/compat/db.py (Diff revision 1)
     
     
    Show all issues
     'logging' imported but unused
    
  7. django_evolution/compat/db.py (Diff revision 1)
     
     
    Show all issues
     local variable 'e' is assigned to but never used
    
  8. django_evolution/compat/db.py (Diff revision 1)
     
     
    Show all issues
     local variable 'out_sql' is assigned to but never used
    
  9. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     'django' imported but unused
    
  10. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     'digest' imported but unused
    
  11. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     'supports_index_together' imported but unused
    
  12. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     local variable 'style' is assigned to but never used
    
  13. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     local variable 'creation' is assigned to but never used
    
  14. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     local variable 'creation' is assigned to but never used
    
  15. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     local variable 'style' is assigned to but never used
    
  16. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     local variable 'creation' is assigned to but never used
    
  17. django_evolution/db/common.py (Diff revision 1)
     
     
    Show all issues
     local variable 'style' is assigned to but never used
    
  18. django_evolution/db/mysql.py (Diff revision 1)
     
     
    Show all issues
     'get_model' imported but unused
    
  19. Show all issues
     'Evolution' imported but unused
    
  20. django_evolution/tests/utils.py (Diff revision 1)
     
     
    Show all issues
     'transaction' imported but unused
    
  21. django_evolution/tests/utils.py (Diff revision 1)
     
     
    Show all issues
     'curry' imported but unused
    
  22. django_evolution/tests/utils.py (Diff revision 1)
     
     
    Show all issues
     'clear_app_cache' imported but unused
    
  23. django_evolution/tests/utils.py (Diff revision 1)
     
     
    Show all issues
     'apps' imported but unused
    
  24. django_evolution/tests/utils.py (Diff revision 1)
     
     
    Show all issues
     'create_constraint_name' imported but unused
    
  25. django_evolution/tests/utils.py (Diff revision 1)
     
     
    Show all issues
     'create_index_together_name' imported but unused
    
  26. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
  2. 
      
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
  2. 
      
david
  1. I don't know much about the new migration stuff so I'm going to rely heavily on your testing. I didn't see any obvious problems with the structure.

  2. django_evolution/management/__init__.py (Diff revision 2)
     
     
    Show all issues

    This blank line shouldn't be here.

  3. django_evolution/management/__init__.py (Diff revision 2)
     
     
     
     
     
    Show all issues

    How about from django.utils.six.moves.cPickle import loads, dumps ?

    1. We haven't dropped support yet for versions of Django without six.

  4. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
  2. django_evolution/compat/apps.py (Diff revision 3)
     
     
    Show all issues
     undefined name 'ImproperlyConfigured'
    
  3. django_evolution/compat/apps.py (Diff revision 3)
     
     
    Show all issues
     undefined name 'ImproperlyConfigured'
    
  4. django_evolution/compat/models.py (Diff revision 3)
     
     
    Show all issues
     local variable 'e' is assigned to but never used
    
  5. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/mutations.py
        django_evolution/tests/test_delete_field.py
        django_evolution/db/common.py
        django_evolution/compat/apps.py
        django_evolution/tests/test_index_together.py
        django_evolution/compat/db.py
        django_evolution/tests/test_database_sig.py
        django_evolution/tests/db/sqlite3.py
        django_evolution/tests/utils.py
        django_evolution/tests/test_add_field.py
        django_evolution/tests/db/postgresql.py
        django_evolution/db/mysql.py
        tests/runtests.py
        django_evolution/tests/test_preprocessing.py
        django_evolution/db/postgresql.py
        django_evolution/tests/db/mysql.py
        django_evolution/management/__init__.py
        django_evolution/compat/models.py
    
    
  2. 
      
brennie
  1. 
      
  2. django_evolution/management/__init__.py (Diff revisions 2 - 4)
     
     
     
     
    Show all issues

    There should be two blank lines between these.

    1. Nevermind, I can read.

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (d9c48e4)