﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27507	use SchemaEditor.execute() to run deferred_sql in migration sync_apps	Lex Berezhny	nobody	"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`."	Cleanup/optimization	closed	Core (Management commands)	dev	Normal	fixed			Accepted	1	0	1	0	0	0
