summaryrefslogtreecommitdiff
path: root/django/core/management/sql.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/management/sql.py')
-rw-r--r--django/core/management/sql.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/django/core/management/sql.py b/django/core/management/sql.py
index ac60ed470c..42ccafa2c5 100644
--- a/django/core/management/sql.py
+++ b/django/core/management/sql.py
@@ -133,14 +133,15 @@ def sql_custom(app, style, connection):
def sql_indexes(app, style, connection):
"Returns a list of the CREATE INDEX SQL statements for all models in the given app."
output = []
- for model in models.get_models(app):
+ for model in models.get_models(app, include_auto_created=True):
output.extend(connection.creation.sql_indexes_for_model(model, style))
return output
+
def sql_destroy_indexes(app, style, connection):
"Returns a list of the DROP INDEX SQL statements for all models in the given app."
output = []
- for model in models.get_models(app):
+ for model in models.get_models(app, include_auto_created=True):
output.extend(connection.creation.sql_destroy_indexes_for_model(model, style))
return output
@@ -191,6 +192,19 @@ def custom_sql_for_model(model, style, connection):
return output
+def emit_pre_sync_signal(create_models, verbosity, interactive, db):
+ # Emit the pre_sync signal for every application.
+ for app in models.get_apps():
+ app_name = app.__name__.split('.')[-2]
+ if verbosity >= 2:
+ print("Running pre-sync handlers for application %s" % app_name)
+ models.signals.pre_syncdb.send(sender=app, app=app,
+ create_models=create_models,
+ verbosity=verbosity,
+ interactive=interactive,
+ db=db)
+
+
def emit_post_sync_signal(created_models, verbosity, interactive, db):
# Emit the post_sync signal for every application.
for app in models.get_apps():