#25733: Change of inherited model's primary key not spotted by makemigrations
----------------------------+--------------------------------------
     Reporter:  dracos      |                    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 dracos):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Looking further, some more interesting details arise. If I use
 "sqlmigrate", the output does include lines to drop the Speaker
 constraint, alter the Speaker's person_ptr_id and putting a constraint
 back; but running "migrate" does not include those lines, that constraint
 is not dropped and so you get the error I quote above when it tries to
 alter Person's ID to a CharField.

 However, it actually wouldn't matter if those lines were present, because
 running the sqlmigrate output manually, you get a different constraint
 failure, the error then changes to be on the same line, but because of
 ForeignKey constraints on other models pointing at the Speaker table (ie.
 I have a Speech table with a speaker ForeignKey). As well as the direct
 constraint, all the constraints associated with the subclass model need to
 be dropped first too, it looks like.

 So possibly two separate issues: sqlmigrate and migrate not having/running
 the same SQL, and not enough constraints being dropped to enable a key to
 be changed from implicit to a CharField.

--
Ticket URL: <https://code.djangoproject.com/ticket/25733#comment:1>
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/064.fa09dd92e522a26ffcde329d7987b6a0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to