#37006: Attempting to recreate the PK in a model with no other fields generates 
a
migration that crashes on SQLite
------------------------------------+------------------------------------
     Reporter:  Carol Naranjo       |                    Owner:  (none)
         Type:  Bug                 |                   Status:  new
    Component:  Migrations          |                  Version:  6.0
     Severity:  Normal              |               Resolution:
     Keywords:  sqlite, migrations  |             Triage Stage:  Accepted
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+------------------------------------
Comment (by Simon Charette):

 Related tickets are #22997 and #29790.

 The way SQLite [https://sqlite.org/lang_altertable.html requires the table
 to be rebuilt on field removal and alterations] would likely force us to
 add a `_django_empty_col` column to support this workflow.

 There might be a way to approach this at the auto-detector level by
 turning a removal and addition of a `Field(primary_key=True)` with a
 different name as a `[AlterField, RenameField]` instead of a
 `[RemoveField, AddField]`. Since a model/table can only have one primary
 key at a time that seems like a better way to approach this problem as it
 would then allow us to focus our efforts on getting `AlterField(from_pk,
 to_pk)` to work in most cases which is what #29790 is about.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37006#comment:2>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019d2af6bd8f-934c45bc-4c8b-4fb4-80d3-906d40891345-000000%40eu-central-1.amazonses.com.

Reply via email to