Skip to content

Commit

Permalink
Refs django#5086 -- Removed unused only_django argument from sql_flus…
Browse files Browse the repository at this point in the history
…h().

Unused (always True) since its introduction in 132605d.
  • Loading branch information
jdufresne authored Jun 4, 2020
1 parent fcdac37 commit f997b5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion django/core/management/commands/flush.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def handle(self, **options):
except ImportError:
pass

sql_list = sql_flush(self.style, connection, only_django=True,
sql_list = sql_flush(self.style, connection,
reset_sequences=reset_sequences,
allow_cascade=allow_cascade)

Expand Down
2 changes: 1 addition & 1 deletion django/core/management/commands/sqlflush.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def add_arguments(self, parser):
)

def handle(self, **options):
sql_statements = sql_flush(self.style, connections[options['database']], only_django=True)
sql_statements = sql_flush(self.style, connections[options['database']])
if not sql_statements and options['verbosity'] >= 1:
self.stderr.write('No tables found.')
return '\n'.join(sql_statements)
10 changes: 2 additions & 8 deletions django/core/management/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
from django.db import models


def sql_flush(style, connection, only_django=False, reset_sequences=True, allow_cascade=False):
def sql_flush(style, connection, reset_sequences=True, allow_cascade=False):
"""
Return a list of the SQL statements used to flush the database.
If only_django is True, only include the table names that have associated
Django models and are in INSTALLED_APPS .
"""
if only_django:
tables = connection.introspection.django_table_names(only_existing=True, include_views=False)
else:
tables = connection.introspection.table_names(include_views=False)
tables = connection.introspection.django_table_names(only_existing=True, include_views=False)
return connection.ops.sql_flush(
style,
tables,
Expand Down

0 comments on commit f997b5e

Please sign in to comment.