#35763: Setting the auto increment value of a database model breaks when you 
add a
new field to the model
-------------------------------------+-------------------------------------
     Reporter:  Kevin Renskers       |                    Owner:  Sachin
                                     |  Kundalwal
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  5.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Kevin Renskers):

 Yeah the `.create` method doesn't work in my real world app since the real
 model has relationships, and I'd also have to create those objects just to
 create a dummy object in the migration.

 It really does feel like a Django bug to me though. It only breaks using
 SQLite, and only when adding a second migration. The initial adjustment of
 the auto increment value works just fine using a proper documented query,
 not via a workaround where we're creating a dummy object. But once I add a
 second field to the model and a new migration is run, the auto increment
 value is lost. Somehow it seems like the `migrations.AddField` operation
 is doing the auto increment value, and only in SQLite.

 I don't understand how this issue is located "in my custom code". I'm just
 updating the auto increment using SQLite's command for that.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35763#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/01070192018c10cc-3acfacb5-41a2-4ea9-96c9-817a53032c08-000000%40eu-central-1.amazonses.com.

Reply via email to