#30595: sqlsequencereset silently exits if there's nothing to do, without informing the user -------------------------------------+------------------------------------- Reporter: Keryn | Owner: nobody Knight | Type: New | Status: new feature | Component: Core | Version: 2.2 (Management commands) | Severity: Normal | Keywords: Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- This just came up on IRC, because someone was expecting `sqlsequencereset` to provide resets for the auto-increment values for an SQLite table.
Running `python manage.py sqlsequencereset <myapp>` provides no output if there are no results returned by `connection.ops.sequence_reset_sql` (see [https://github.com/django/django/blob/26d16c07fdc4a297daca554afa6375c70d6d82a9/django/core/management/commands/sqlsequencereset.py#L23 here]) So the user has no idea if it failed, succeeded, or they got the invocation wrong (assuming they're not familiar enough with Django to know that invoking it wrong will raise a `CommandError`). I'd suggest it should avoid ambiguity, so if `len(statements) == 0` it should raise `CommandError` and say there's nothing to do. Bonus points if it also sniffs the connection backend to know if there is anything it **could** do, and if there's not, report that `sqlsequencereset` isn't necessary/available for that backend. -- Ticket URL: <https://code.djangoproject.com/ticket/30595> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.c148f7dfc980a608c418d31430ce4e7a%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.