Opened 8 years ago
Closed 8 years ago
#27507 closed Cleanup/optimization (fixed)
use SchemaEditor.execute() to run deferred_sql in migration sync_apps
Reported by: | Lex Berezhny | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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:
- 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)
- When
cursor.execute()
is hard coded insync_app
it is not possible to do custom processing of the SQL (as could be done with a customDatabaseSchemaEditor.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
.
Change History (2)
comment:1 by , 8 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In 8eb56f3c: