#24369: flush requires migrations
-------------------------------------+-------------------------------------
     Reporter:  tanner               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  1.7
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:  flush                |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by claudep):

 * needs_better_patch:   => 0
 * component:  Uncategorized => Core (Management commands)
 * needs_tests:   => 0
 * keywords:   => flush
 * needs_docs:   => 0
 * type:  Uncategorized => Cleanup/optimization
 * stage:  Unreviewed => Accepted


Comment:

 Suggested change:
 {{{ #!diff
 diff --git a/django/core/management/commands/flush.py
 b/django/core/management/commands/flush.py
 index 97c9450..eceb873 100644
 --- a/django/core/management/commands/flush.py
 +++ b/django/core/management/commands/flush.py
 @@ -46,6 +46,10 @@ class Command(BaseCommand):
          sql_list = sql_flush(self.style, connection, only_django=True,
                               reset_sequences=reset_sequences,
                               allow_cascade=allow_cascade)
 +        if not sql_list:
 +            raise CommandError(
 +                "No commands to proceed with, maybe the database is still
 empty?"
 +            )

          if interactive:
              confirm = input("""You have requested a flush of the
 database.
 }}}

 I'm not absolutely convinced about the need to write a test for that...

--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.798d0fb168807306e832648768695ddb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to