#23505: unique constraint tracking lost after DropColumn + AddColumn in postgres
----------------------------+-----------------------------
     Reporter:  CloudNiner  |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.7
     Severity:  Normal      |   Keywords:  unique_together
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+-----------------------------
 Reproduce:
 1. Create model with a multi-column uniqueness constraint in postgres
 2. Drop a column in the uniqueness constraint, then readd it with a
 different type.
 e.g:
 {{{#!python
 foo = models.IntegerField()
 # to
 foo = models.CharField(max_length=255)
 }}}
 3. Attempt to modify the uniqueness constraint and run the subsequent
 migration. It fails with 'ValueError: Found wrong number (0) of
 constraints for <tablename>'

 This is likely due to django not tracking postgres automatically dropping
 the uniqueness constraint when a column is deleted/added.
 See 'Description -> DROP COLUMN':
 http://www.postgresql.org/docs/9.1/static/sql-altertable.html

--
Ticket URL: <https://code.djangoproject.com/ticket/23505>
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/053.3b9274807fa06959ad17c41018896a9b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to