#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
-------------------------------------+-------------------------------------

Comment (by axil):

 > Before any code is added here
 It might have come unnoticed but there is the code already ;)
 
https://github.com/django/django/blob/6f33f7dcf3ef20d0585bece747887c7054cf2189/django/db/backends/sqlite3/operations.py#L232-L257

 > I think that we should add backend agnostics tests for the command that
 execute the provided SQL and assert it has the desired effects.
 One of the tests that I've added
 (django/tests/backends/tests.py:SequenceResetTest.test_reset_sequence)
 looks pretty backend agnostic to me:
 
https://github.com/axil/django/blob/7de27842c038d087257ebdd8e964f8921cd68295/tests/backends/tests.py#L186-L203
 I've improved it a bit now.

 >In a following commit the logic that identifies the sequences that need
 to be reset should be moved to the command itself
 Actually of the logic identifying the sequences has already been moved to
 the django.core.commands.sqlsequencerest:
 
https://github.com/django/django/blob/6f33f7dcf3ef20d0585bece747887c7054cf2189/django/core/management/commands/sqlsequencereset.py#L17-L25
 or to be precise to `app_config.get_models(include_auto_created=True)`. By
 that reason

 > to avoid the huge amount of boilerplate repeated in the current
 PostgreSQL and Oracle DatabaseOperations implementations.
 this boilerplate can be cut in half as I suggest in #31731. In what is
 left after that yes, postgresql and oracle share the same logic and can be
 refactored, but sqlite needs a somewhat different SQL statement so I see
 little room for refactoring here.

 > That will also avoid leaking db.models abstraction to the db.backends
 ones
 Yes, my patch doesn't do that.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31730#comment:5>
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.2144dd653e0f07e7ec6652b4e71040ff%40djangoproject.com.

Reply via email to