Re: [Django] #25621: AlterField to ForeignKey reverse migration doesn't drop the constraint

2015-11-17 Thread Django
#25621: AlterField to ForeignKey reverse migration doesn't drop the constraint
+--
 Reporter:  mgedmin |Owner:  nobody
 Type:  Bug |   Status:  closed
Component:  Migrations  |  Version:  1.8
 Severity:  Normal  |   Resolution:  needsinfo
 Keywords:  | 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/065.a79e17e22f932608e9d3664618a6566f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25621: AlterField to ForeignKey reverse migration doesn't drop the constraint

2015-10-28 Thread Django
#25621: AlterField to ForeignKey reverse migration doesn't drop the constraint
+--
 Reporter:  mgedmin |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 mgedmin):

 MySQL (unfortunately).

 The actual project where I stumbled upon this is open source:
 
https://github.com/ManoSeimas/manoseimas.lt/blob/master/manoseimas/mps_v2/migrations/0029_link_suggestion_to_committeeresolution.py

 I'll try to provide a minimal example.

--
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/065.bb0842d0c129b045cb21ace03c6f96bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25621: AlterField to ForeignKey reverse migration doesn't drop the constraint

2015-10-28 Thread Django
#25621: AlterField to ForeignKey reverse migration doesn't drop the constraint
+--
 Reporter:  mgedmin |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
+--
Changes (by timgraham):

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


Comment:

 What database are you using? Could you provide a complete minimal project
 that reproduces it?

--
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/065.471b02fc564a278d51727a762be0d7fd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #25621: AlterField to ForeignKey reverse migration doesn't drop the constraint

2015-10-28 Thread Django
#25621: AlterField to ForeignKey reverse migration doesn't drop the constraint
+
 Reporter:  mgedmin |  Owner:  nobody
 Type:  Bug | Status:  new
Component:  Migrations  |Version:  1.8
 Severity:  Normal  |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0   |  UI/UX:  0
+
 I'm changing a data model that had a
 {{{
 source_id = CharField()
 }}}
 field to a
 {{{
 source_resolution = ForeignKey(CommitteeResolution, db_column='source_id',
 to_field='source_id')
 }}}
 so that my database schema remains the same, but now the column is a
 foreign key reference to another table.

 I've adjusted the migrations file manually to avoid dropping/re-creating
 columns.  The migration looks like this now:
 {{{
 operations = [
 migrations.AlterField(
 model_name='suggestion',
 name='source_id',
 field=models.ForeignKey(db_column=b'source_id',
 to_field=b'source_id', to='mps_v2.CommitteeResolution'),
 preserve_default=False,
 ),
 migrations.RenameField(
 model_name='suggestion',
 old_name='source_id',
 new_name='source_resolution',
 ),
 migrations.AlterUniqueTogether(
 name='suggestion',
 unique_together=set([('source_resolution', 'source_index')]),
 ),
 ]
 }}}

 The forward migration is exactly as I expect it to be:

 {{{
 $ django-admin sqlmigrate mps_v2 0029
 BEGIN;
 ALTER TABLE `mps_v2_suggestion` ADD CONSTRAINT
 `D58bb2cf0b1407c8c24fa06b0cc34f38` FOREIGN KEY (`source_id`) REFERENCES
 `mps_v2_committeeresolution` (`source_id`);

 COMMIT;
 }}}

 I expect the reverse migration to drop the constraint.

 It doesn't:

 {{{
 $ django-admin sqlmigrate mps_v2 0029 --backwards
 }}}

 (there's no output).

--
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/050.5ff8885e78fe30d1804bec5d211f6998%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.