#23740: Cannot drop unique_together constraint on primary key
----------------------------+------------------------------------
Reporter: lanzz | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------
Changes (by matthewwestcott):
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
Confirmed on current master. On a new postgresql-based project:
* create a new app 'foo' with the following models.py
{{{
from django.db import models
class Bar(models.Model):
name = models.CharField(max_length=255)
class Meta:
unique_together = (('id',),)
}}}
* ./manage.py makemigrations
* ./manage.py migrate
* comment out the 'class Meta'
* ./manage.py makemigrations
* ./manage.py migrate
This is not specific to the primary key field - it happens more generally
on single-field unique_together constraints that duplicate a unique=True
constraint, such as:
{{{
class Bar(models.Model):
name = models.CharField(max_length=255, unique=True)
class Meta:
unique_together = (('name'),)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23740#comment:3>
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.ef9d6171c33c21e6263ffa0729af47a1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.