#24030: default id field not migrated correctly
----------------------------+--------------------------------------
Reporter: Brian May | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by Anupam):
* status: closed => new
* resolution: fixed =>
Comment:
Did a new ticket ever get opened for this one? I am seeing the same
behaviour on Django 1.10.2.
I used a custom primary key and later decided to go back to Django's
default primary key (by not specifying any). On running makemigrations, it
asked for default value for auto-generated ID field (because of the issue
discussed in #22997). Providing a default ID also doesn't help because on
running the migration, it gives the error 'Multiple default values
specified for column “modelname_id"' ' which is expected since its an
auto-increment field. To get around that, it seems the only solution is as
mentioned here [http://stackoverflow.com/a/37356512/1526703] where the
default is actually supplied at the prompt and then manually deleted from
the migration created. After using the above workaround, the issue talked
about in this ticket gets revealed (i.e the id field no longer auto-
increments). Dropping the db and removing all migrations was the only
thing that worked for me to get the default "id" field to auto-increment
(otherwise keep getting the error 'null value in column "id" violates not-
null constraint' on any insert).
--
Ticket URL: <https://code.djangoproject.com/ticket/24030#comment:9>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.6f9b85e351ebba7ce0403d2656386ceb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.