#27826: Django migration can not find existing constraint
-----------------------------------------+------------------------
               Reporter:  Michal Čihař   |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  1.10
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 I've a project with long history. The databases were originally migrated
 by South and then it has moved to Django migrations.

 Now when I've made changes to unique_together constraint, I got migration
 failure:

 {{{
 ValueError: Found wrong number (0) of constraints for
 trans_check(contentsum, project_id, language_id, check)
 }}}

 This seems to be caused by the constraing being created in different order
 in past. I think it has been created by South, but I'm not 100% sure. But
 anyway I've ended up with half applied migration what is not really a
 pleasant state.

 I've fixed this for me by comparing fields as set not as lists (see
 attached patch), what is certainly okay for unique constraints, but is
 probably bad idea for general indexes.

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

Reply via email to