#36401: Adding CompositePrimaryKey to existing table leads to drop existing PK 
with
not composite PK creation
--------------------------------+--------------------------------------
     Reporter:  Pavel Tyslacki  |                    Owner:  (none)
         Type:  New feature     |                   Status:  closed
    Component:  Migrations      |                  Version:  5.2
     Severity:  Normal          |               Resolution:  wontfix
     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 Jacob Walls):

 * resolution:   => wontfix
 * status:  new => closed
 * type:  Bug => New feature

Comment:

 Hi, thanks for the report. This is
 [https://docs.djangoproject.com/en/5.2/topics/composite-primary-key
 /#migrating-to-a-composite-primary-key documented] as not supported:

 > Django doesn’t support migrating to, or from, a composite primary key
 after the table is created. It also doesn’t support adding or removing
 fields from the composite primary key.
 > If you would like to migrate an existing table from a single primary key
 to a composite primary key, follow your database backend’s instructions to
 do so.
 > Once the composite primary key is in place, add the CompositePrimaryKey
 field to your model. This allows Django to recognize and handle the
 composite primary key appropriately.

 Adding support for this would be a new feature, so setting a "wontfix"
 status on this tracker with the reason that new features are currently
 tracked [https://github.com/django/new-features elsewhere].
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36401#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/01070196eaac161b-05e07761-5a19-474e-a8bd-bbd966ceec7f-000000%40eu-central-1.amazonses.com.

Reply via email to