Re: [Django] #23505: unique constraint tracking lost after DropColumn + AddColumn in postgres

2014-09-23 Thread Django
#23505: unique constraint tracking lost after DropColumn + AddColumn in postgres
-+--
 Reporter:  CloudNiner   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  1.7
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:  unique_together  | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => needsinfo


--
Ticket URL: 
Django 
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/068.35f71c30456b8990e99c8fd8f425d76d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23505: unique constraint tracking lost after DropColumn + AddColumn in postgres

2014-09-19 Thread Django
#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   |   Resolution:
 Keywords:  unique_together  | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by bmispelon):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Hi,

 Could you give us some more details on how to reproduce the issue?

 I tried using this model:
 {{{
 #!python
 class Foo(models.Model):
 foo = models.IntegerField()
 bar = models.IntegerField()

 class Meta:
 unique_together = (('foo', 'bar'),)
 }}}
 Then I ran `makemigrations` and `migrate`.
 After that, I changed the `bar` field to `bar =
 models.CharField(max_length=10)` and ran `makemigrations` and `migrate`
 again.

 But when I do that, I can see that the unique constraint is still there:
 {{{
 Table "public.bug23505_foo"
  Column | Type  | Modifiers
 
+---+---
  id | integer   | not null default
 nextval('bug23505_foo_id_seq'::regclass)
  foo| integer   | not null
  bar| character varying(10) | not null
 Indexes:
 "bug23505_foo_pkey" PRIMARY KEY, btree (id)
 "bug23505_foo_foo_30361d88471c726e_uniq" UNIQUE CONSTRAINT, btree
 (foo, bar)
 }}}

 Thanks.

--
Ticket URL: 
Django 
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/068.0cdde17e27bf58c6d4056cbc8f4867cb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #23505: unique constraint tracking lost after DropColumn + AddColumn in postgres

2014-09-17 Thread Django
#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 '

 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: 
Django 
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.