#27267: Migrations: Need API to drop a foreign key constraint --------------------------------+-------------------------------------- Reporter: Melvyn Sopacua | 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 --------------------------------+--------------------------------------
Comment (by Melvyn Sopacua): I'm not using the to_field argument explicitedly (but my to_field is not named 'id') and that bug report is setup to be limited to a few cases. So far my experience is that any change to a model field that affects a foreign key pointing to it will blow up. This includes renaming the field, changing it's type or making a different field the primary key. The minimal case is this: {{{#!python class ItemType(models.Model): item_id = models.AutoField(primary_key=True) name = models.CharField(max_length=63) class Item(models.Model): item_type = models.ForeignKey(ItemType) name = models.CharField(max_length=63) }}} Now change ItemType.item_id to ItemType.item_type_id. If this doesn't blow up for you, let me know and I'll make a proper test case. -- Ticket URL: <https://code.djangoproject.com/ticket/27267#comment:5> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.1dbe39de4072c35fffb21770a8d73814%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.