#34058: Widening AutoField to BigAutoField, fails to widen the sequence.
-------------------------------------+-------------------------------------
     Reporter:  Anders Kaseorg       |                    Owner:  Mariusz
                                     |  Felisiak
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  4.1
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Anders Kaseorg):

 I found a scenario in which this fix doesn’t work: if the field had been
 renamed before the upgrade, the corresponding sequence will not have been
 renamed.

 To modify my above reproduction recipe, insert a new step between steps 3
 and 4 renaming the field:

 {{{
 #!python
 # my_app/models.py
 from django.db import models
 class Widget(models.Model):
     renamed_id = models.SmallAutoField(primary_key=True)
 }}}

 {{{
 #!console
 $ ./manage.py makemigrations
 Was widget.id renamed to widget.renamed_id (a SmallAutoField)? [y/N] y
 Migrations for 'my_app':
   my_app/migrations/0002_rename_id_widget_renamed_id.py
     - Rename field id on widget to renamed_id
 $ ./manage.py migrate
 Operations to perform:
   Apply all migrations: my_app
 Running migrations:
   Applying my_app.0002_rename_id_widget_renamed_id... OK
 }}}

 (and then keep the new name in step 5).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34058#comment:7>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701838b382da2-a831c59e-7931-40fd-9b78-b6ecef6fe3ba-000000%40eu-central-1.amazonses.com.

Reply via email to