Ticket #9717: 9717.flush_command.diff
File 9717.flush_command.diff, 2.0 KB (added by , 16 years ago) |
---|
-
django/django/core/management/commands/flush.py
27 27 except ImportError: 28 28 pass 29 29 30 sql_list = sql_flush(self.style, only_django=True )30 sql_list = sql_flush(self.style, only_django=True, only_existing_django=True) 31 31 32 32 if interactive: 33 33 confirm = raw_input("""You have requested a flush of the database. -
django/django/core/management/sql.py
116 116 "Returns a list of the DROP TABLE SQL, then the CREATE TABLE SQL, for the given module." 117 117 return sql_delete(app, style) + sql_all(app, style) 118 118 119 def sql_flush(style, only_django=False ):119 def sql_flush(style, only_django=False, only_existing_django=False): 120 120 """ 121 121 Returns a list of the SQL statements used to flush the database. 122 122 123 If only_django is True, then only table names that have associated Django123 * If only_django is True, then only table names that have associated Django 124 124 models and are in INSTALLED_APPS will be included. 125 * only_existing_django is only considered if only_django is True. If 126 only_existing_django is True, then only table names which *actually exist* 127 in database will be included. 125 128 """ 126 129 from django.db import connection 127 130 if only_django: 128 tables = connection.introspection.django_table_names( )131 tables = connection.introspection.django_table_names(only_existing=only_existing_django) 129 132 else: 130 133 tables = connection.introspection.table_names() 131 134 statements = connection.ops.sql_flush(style, tables, connection.introspection.sequence_list())