Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2020-04-10 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"f5ede1cb6da473166d22c04dcbd8240e2a0f223d" f5ede1cb]:
 {{{
 #!CommitTicketReference repository=""
 revision="f5ede1cb6da473166d22c04dcbd8240e2a0f223d"
 Refs #28305 -- Consolidated field referencing detection in migrations.

 This moves all the field referencing resolution methods to shared
 functions instead of duplicating efforts amongst state_forwards and
 references methods.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.e2a054bf0ca53221e2b9e7f1c24b9396%40djangoproject.com.


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2018-09-23 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andrew Badr):

 Replying to [comment:15 Tim Graham ]:
 > In [changeset:"b8a2f3c2d66aa15af4be745a576609b958a853c0" b8a2f3c]:
 > {{{
 > #!CommitTicketReference repository=""
 revision="b8a2f3c2d66aa15af4be745a576609b958a853c0"
 > [1.11.x] Fixed #28305 -- Fixed "Cannot change column 'x': used in a
 foreign key constraint" crash on MySQL with a sequence of AlterField or
 RenameField operations.
 >
 > Regression in 45ded053b1f4320284aa5dac63052f6d1baefea9.
 >
 > Backport of c3e0adcad8d8ba94b33cabd137056166ed36dae0 from master
 > }}}

 This patch broke my project! See #29787

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-12-01 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"b8a2f3c2d66aa15af4be745a576609b958a853c0" b8a2f3c]:
 {{{
 #!CommitTicketReference repository=""
 revision="b8a2f3c2d66aa15af4be745a576609b958a853c0"
 [1.11.x] Fixed #28305 -- Fixed "Cannot change column 'x': used in a
 foreign key constraint" crash on MySQL with a sequence of AlterField or
 RenameField operations.

 Regression in 45ded053b1f4320284aa5dac63052f6d1baefea9.

 Backport of c3e0adcad8d8ba94b33cabd137056166ed36dae0 from master
 }}}

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-12-01 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"4dc35e126d8461589b4b4bc47b6f6bd6cc4a1455" 4dc35e12]:
 {{{
 #!CommitTicketReference repository=""
 revision="4dc35e126d8461589b4b4bc47b6f6bd6cc4a1455"
 [2.0.x] Fixed #28305 -- Fixed "Cannot change column 'x': used in a foreign
 key constraint" crash on MySQL with a sequence of AlterField or
 RenameField operations.

 Regression in 45ded053b1f4320284aa5dac63052f6d1baefea9.

 Backport of c3e0adcad8d8ba94b33cabd137056166ed36dae0 from master
 }}}

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-12-01 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

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


Comment:

 In [changeset:"c3e0adcad8d8ba94b33cabd137056166ed36dae0" c3e0adc]:
 {{{
 #!CommitTicketReference repository=""
 revision="c3e0adcad8d8ba94b33cabd137056166ed36dae0"
 Fixed #28305 -- Fixed "Cannot change column 'x': used in a foreign key
 constraint" crash on MySQL with a sequence of AlterField or RenameField
 operations.

 Regression in 45ded053b1f4320284aa5dac63052f6d1baefea9.
 }}}

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-30 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/8692 WIP PR]

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-28 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 Markus, do you have any suggestions about how to fix this? I confirmed
 that reverting the
 
[https://github.com/django/django/commit/45ded053b1f4320284aa5dac63052f6d1baefea9
 #diff-efb7d00c2383393046c9c5d842f45499R201 delayed rendering changes] to
 `AlterField` fixes it. Maybe the reloading shouldn't be delayed if a field
 is pointed to by a foreign key? (i.e. reloading should be delayed for both
 forward and reverse relations)

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-19 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Markus Holtermann):

 Thanks for the report Andreas. I took a shot at this. Here's what I found:

 * This issue doesn't seem to manifest on PostgreSQL
 * The SQL created in `sqlmigrate` (which you posted above) works (you can
 run that manually and the constraints get dropped and recreated as
 intended)
 * `manage.py migrate` for whatever reason does _not_ run the `ALTER TABLE
 myapp_agreement DROP FOREIGN KEY
 myapp_agreement_member_id_0dc75c75_fk_myapp_member_id;` on 1.11.x which is
 due to `_related_non_m2m_objects()` in
 
https://github.com/django/django/blob/stable/1.11.x/django/db/backends/base/schema.py#L551
 not returning related objects.

 {{{
 $ python manage.py sqlmigrate myapp 0002 --settings
 onetoone.mysql_settings
 >
 /home/markus/Coding/django/django/db/backends/base/schema.py(549)_alter_field()
 548 import ipdb; ipdb.set_trace()
 --> 549 if old_field.primary_key and new_field.primary_key and
 old_type != new_type:
 550 # '_meta.related_field' also contains M2M reverse
 fields, these

 ipdb> ipdb> tuple(_related_non_m2m_objects(old_field, new_field))
 ((, ),)
 ipdb> c
 ALTER TABLE `myapp_member` DROP FOREIGN KEY
 `myapp_member_group_id_31ff18be_fk`; (params ())
 ALTER TABLE `myapp_group` MODIFY `id` varchar(191) NOT NULL; (params [])
 ALTER TABLE `myapp_member` MODIFY `group_id` varchar(191) NULL; (params
 [])
 ALTER TABLE `myapp_member` ADD CONSTRAINT
 `myapp_member_group_id_31ff18be_fk` FOREIGN KEY (`group_id`) REFERENCES
 `myapp_group` (`id`); (params ())
 >
 /home/markus/Coding/django/django/db/backends/base/schema.py(549)_alter_field()
 548 import ipdb; ipdb.set_trace()
 --> 549 if old_field.primary_key and new_field.primary_key and
 old_type != new_type:
 550 # '_meta.related_field' also contains M2M reverse
 fields, these

 ipdb> tuple(_related_non_m2m_objects(old_field, new_field))
 ((, ),)
 ipdb> c
 ALTER TABLE `myapp_agreement` DROP FOREIGN KEY
 `myapp_agreement_member_id_0dc75c75_fk_myapp_member_id`; (params ())
 ALTER TABLE `myapp_member` MODIFY `id` varchar(191) NOT NULL; (params [])
 ALTER TABLE `myapp_agreement` MODIFY `member_id` varchar(191) NULL;
 (params [])
 ALTER TABLE `myapp_agreement` ADD CONSTRAINT
 `myapp_agreement_member_id_0dc75c75_fk` FOREIGN KEY (`member_id`)
 REFERENCES `myapp_member` (`id`); (params ())
 >
 /home/markus/Coding/django/django/db/backends/base/schema.py(549)_alter_field()
 548 import ipdb; ipdb.set_trace()
 --> 549 if old_field.primary_key and new_field.primary_key and
 old_type != new_type:
 550 # '_meta.related_field' also contains M2M reverse
 fields, these

 ipdb> c
 ALTER TABLE `myapp_agreement` MODIFY `id` varchar(191) NOT NULL; (params
 [])
 BEGIN;
 --
 -- Alter field id on group
 --
 ALTER TABLE `myapp_member` DROP FOREIGN KEY
 `myapp_member_group_id_31ff18be_fk`;
 ALTER TABLE `myapp_group` MODIFY `id` varchar(191) NOT NULL;
 ALTER TABLE `myapp_member` MODIFY `group_id` varchar(191) NULL;
 ALTER TABLE `myapp_member` ADD CONSTRAINT
 `myapp_member_group_id_31ff18be_fk` FOREIGN KEY (`group_id`) REFERENCES
 `myapp_group` (`id`);
 --
 -- Alter field id on member
 --
 ALTER TABLE `myapp_agreement` DROP FOREIGN KEY
 `myapp_agreement_member_id_0dc75c75_fk_myapp_member_id`;
 ALTER TABLE `myapp_member` MODIFY `id` varchar(191) NOT NULL;
 ALTER TABLE `myapp_agreement` MODIFY `member_id` varchar(191) NULL;
 ALTER TABLE `myapp_agreement` ADD CONSTRAINT
 `myapp_agreement_member_id_0dc75c75_fk` FOREIGN KEY (`member_id`)
 REFERENCES `myapp_member` (`id`);
 --
 -- Alter field id on agreement
 --
 ALTER TABLE `myapp_agreement` MODIFY `id` varchar(191) NOT NULL;
 COMMIT;
 }}}
 {{{
 $ python manage.py migrate myapp 0002 --settings onetoone.mysql_settings
 System check identified some issues:

 WARNINGS:
 ?: (mysql.W002) MySQL Strict Mode is not set for database connection
 'default'
 HINT: MySQL's Strict Mode fixes many data integrity problems in
 MySQL, such as data truncation upon insertion, by escalating warnings into
 errors. It is strongly recommended you 

Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-17 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Release blocker  |   Resolution:
 Keywords:  mysql,   | Triage Stage:  Accepted
  onetoonefield, utf8mb4, foreign|
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-15 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * cc: Markus Holtermann (added)


Comment:

 Bisected to 45ded053b1f4320284aa5dac63052f6d1baefea9,  Fixed #27666 --
 Delayed rendering of recursivly related models in migration operations.

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-14 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andreas Backx):

 Alright, thank you for the link. Will do.

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-14 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 Test and fix can be in the same commit, see the PatchReviewChecklist.

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-14 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andreas Backx):

 I'll try to create a test for the Django's test suite hopefully this week
 and bisect it that way as something came up that needs to prioritisation
 here. Should I add the failing test in the first commit and add a patch in
 the second commit of the PR?

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-13 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 A starting point would be to
 [https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
 tickets/#bisecting-a-regression bisect] to find the commit where the
 behavior changed. If writing a test for Django's test suite is too
 difficult for you, you can always bisect manually using your test project.

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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-13 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Andreas Backx):

 * type:  Uncategorized => Bug


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


Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-13 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Uncategorized|   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Andreas Backx:

Old description:

> ''A test case has been created here: https://github.com/AndreasBackx
> /Django-OneToOneFieldBug-Example. How to run the test case is described
> there.''
>
> There is a migration issue when moving from Django 1.10.7 to Django
> 1.11.2. This sample I made is a slimmed down version from an internal
> library which moved from utf8 to utf8mb4 in MySQL. This required the keys
> to be changed from 255 characters to 191 characters in order to be
> compatible with older versions of MySQL but the reason is irrelevant
> here. The issue is that Django 1.11.2+ tries to change the 'id' column of
> which the max_length has been changed from 255 to 191 that still has a
> constraint. It results in the following error:
>
> {{{
> django.db.utils.OperationalError: (1833, "Cannot change column 'id': used
> in a foreign key constraint
> 'myapp_agreement_member_id_0dc75c75_fk_myapp_member_id' of table
> 'test_onetoone.myapp_agreement'")
> }}}
>
> This is the full traceback:
>
> {{{
>   Applying myapp.0002_utf8mb4...Traceback (most recent call last):
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/db/backends/utils.py", line 65, in execute
> return self.cursor.execute(sql, params)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/db/backends/mysql/base.py", line 101, in execute
> return self.cursor.execute(query, args)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/MySQLdb/cursors.py", line 250, in execute
> self.errorhandler(self, exc, value)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
> raise errorvalue
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/MySQLdb/cursors.py", line 247, in execute
> res = self._query(query)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/MySQLdb/cursors.py", line 411, in _query
> rowcount = self._do_query(q)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/MySQLdb/cursors.py", line 374, in _do_query
> db.query(q)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/MySQLdb/connections.py", line 292, in query
> _mysql.connection.query(self, query)
> _mysql_exceptions.OperationalError: (1833, "Cannot change column 'id':
> used in a foreign key constraint
> 'myapp_agreement_member_id_0dc75c75_fk_myapp_member_id' of table
> 'test_onetoone.myapp_agreement'")
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "manage.py", line 22, in 
> execute_from_command_line(sys.argv)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/core/management/__init__.py", line 363, in
> execute_from_command_line
> utility.execute()
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/core/management/__init__.py", line 355, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/core/management/commands/test.py", line 29, in
> run_from_argv
> super(Command, self).run_from_argv(argv)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/core/management/base.py", line 283, in run_from_argv
> self.execute(*args, **cmd_options)
>   File "/path/to/project/django-onetoone-
> test/.tox/py35-django-111/lib/python3.5/site-
> packages/django/core/management/base.py", line 330, in execute
> output = self.handle(*args, **options)
>   File "/path/to/project/django-onetoone-
> 

Re: [Django] #28305: AlterField migration tries to alter column that still has a foreign key contraint

2017-06-13 Thread Django
#28305: AlterField migration tries to alter column that still has a foreign key
contraint
-+-
 Reporter:  Andreas Backx|Owner:  nobody
 Type:  Uncategorized|   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  mysql,   | Triage Stage:
  onetoonefield, utf8mb4, foreign|  Unreviewed
  key|
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Andreas Backx):

 * keywords:  mysql, onetoonefield, utf8mb4 => mysql, onetoonefield,
 utf8mb4, foreign key


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