#27507: use SchemaEditor.execute() to run deferred_sql in migration sync_apps
-------------------------------------+-------------------------------------
               Reporter:  Lex        |          Owner:  nobody
  Berezhny                           |
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  Core       |        Version:  master
  (Management commands)              |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  1
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Associated GitHub Pull Request: https://github.com/django/django/pull/7579

 This is a very simple fix for the `sync_app` method in the `migration`
 command that uses `editor.execute()` to execute deferred sql instead of
 directly using `cursor.execute()`.

 There are two reasons for this:

 1. This is consistent with the normal migrateable apps workflow where
 deferred SQL is executed using `editor.execute()`. See:
 
[django/db/backends/base/schema.py#L91](https://github.com/django/django/blob/371adc472a2a1f09923101e3c4fda60cdff96028/django/db/backends/base/schema.py#L91)

 2. When `cursor.execute()` is hard coded in `sync_app` it is not possible
 to do custom processing of the SQL (as could be done with a custom
 `DatabaseSchemaEditor.execute()`).

 This pull request does not change any existing functionality and is
 backwards compatible but it provides a more consistent, intuitive and
 predictable behavior when extending `DatabaseSchemaEditor`.

--
Ticket URL: <https://code.djangoproject.com/ticket/27507>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.fda206068c83b55b09313b423b4dc05c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to