#31730: manage.py sqlsequencereset not implemented for sqlite3
-------------------------------------+-------------------------------------
Reporter: axil | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: sql sequence reset | Triage Stage: Accepted
sqlite3 |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted
Comment:
TIL about the `sqlsequencereset` command!
It seems to be barely tested
-
https://github.com/django/django/blob/3152146e3abd029be2457d2e780599d399db0fe2/tests/empty_models/test_commands.py#L20
-
https://github.com/django/django/blob/b9cf764be62e77b4777b3a75ec256f6209a57671/tests/bash_completion/tests.py#L81
And not implemented on both SQLite and MySQL!
Before any code is added here I think that we should add backend agnostics
tests for the command that execute the provided SQL and assert it has the
desired effects. This will likely require skipping the tests on SQLite and
MySQL at first.
In a following commit the logic that identifies the sequences that need to
be reset should be moved to the command itself to avoid the huge amount of
boilerplate repeated in the current PostgreSQL and Oracle
`DatabaseOperations` implementations. That will also avoid leaking
`db.models` abstraction to the `db.backends` ones. We should probably use
`connection.introspection.sequence_list()` to ''JOIN'' its return value to
the specified model subset tables. In the end I think the signature of the
of the `sequence_reset_sql` method should be something like `(style,
sequences)`.
Then we should be able to add support for both SQLite and MySQL.
--
Ticket URL: <https://code.djangoproject.com/ticket/31730#comment:4>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/062.1310bcbe18136e87d2569222fca337e3%40djangoproject.com.