Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2024-03-18 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
--+
 Reporter:  Panagis Alisandratos  |Owner:  (none)
 Type:  Cleanup/optimization  |   Status:  new
Component:  Migrations|  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:  migration,optimizer   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Ülgen Sarıkavak):

 * cc: Ülgen Sarıkavak (added)

-- 
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/0107018e504f9e6a-2bff4f57-b497-43a6-9e6b-bfc85954355a-00%40eu-central-1.amazonses.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2022-03-05 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
--+
 Reporter:  Panagis Alisandratos  |Owner:  (none)
 Type:  Cleanup/optimization  |   Status:  new
Component:  Migrations|  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:  migration,optimizer   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * owner:  Simon Charette => (none)
 * status:  assigned => new


-- 
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/0107017f59d574db-7b59521f-34aa-4628-b667-531dda7f19ef-00%40eu-central-1.amazonses.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2021-03-01 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Simon
  Alisandratos   |  Charette
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * has_patch:  1 => 0


-- 
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/066.3978aa260f0bd985405371aee0aa51f0%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2021-01-17 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Simon
  Alisandratos   |  Charette
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * owner:  (none) => Simon Charette
 * status:  new => assigned
 * has_patch:  0 => 1


Comment:

 Submitted a draft PR.

 I'd like to try a shot at an alternative patch that changes
 `Operation.reduce`  signature to `(operation: Operation, app_label: str,
 state: ProjectState)` to allow the optimization to be enabled even for
 legacy projects with migrations that haven't tracked removed field and
 models over time. It would also avoid a ''public'' API change for
 `RemoveField` and `DeleteModel`.

-- 
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/066.61ac217ebe5e4daa5e61d8f5c15ad630%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-03-16 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
--+
 Reporter:  Panagis Alisandratos  |Owner:  (none)
 Type:  Cleanup/optimization  |   Status:  new
Component:  Migrations|  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  migration,optimizer   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Rohit Jha):

 * owner:  Rohit Jha => (none)
 * status:  assigned => new


Comment:

 Sanskar Jaiswal: Please feel free to pick this

-- 
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/066.f6fdccc6e325c56f909c3b58ea42f8b4%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-03-01 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 I wouldn't worry too much about attribution, mergers can use the Git `Co-
 authored-by` feature to give attribution to multiple contributors.

-- 
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/066.2498314c7d419950440c1cd06ab9f5e7%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-03-01 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sanskar Jaiswal):

 While working on my branch, I manually changed all the files to reflect
 the changes you made on your branch, and then made some further changes on
 my own. I was wondering if there is a way, that the megers recognize that
 the PR contains your work too, since if I simply create a PR, there would
 be no way of you getting any credit.

-- 
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/066.5a0e53e908f5bcc0658711fc9df3d441%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-03-01 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 > After going through this, I have built on top of this and further fixed
 the ManyToManyField removal test cases and added another test case for
 this ticket as well

 Nice, I think `test_non_cyclical_models_removals` already covers this
 ticket's case though; no need to add another one at the auto-detector
 level IMO.

 > How should I create the PR, given that I have built on top of your
 existing code?

 Assuming you pushed your work to a branch that includes the above commit
 it should be the same process as opening any other PR. I'd leave the two
 commits separated so they can be reorganized by the mergers as they deem
 the most appropriate.

-- 
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/066.22823ac55a300423f20b361733847438%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-03-01 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sanskar Jaiswal):

 Replying to [comment:13 Simon Charette]:
 > Here's
 [https://github.com/django/django/compare/master...charettes:ticket-31255
 a branch pushing the idea above further].
 After going through this, I have built on top of this and further fixed
 the ManyToManyField removal test cases and added another test case for
 this ticket as well. How should I create the PR, given that I have built
 on top of your existing code.

-- 
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/066.a24eb4bb6752163a54d2e940ad106eaf%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-28 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Here's
 [https://github.com/django/django/compare/master...charettes:ticket-31255
 a branch pushing the idea above further].

 It currently has two failures related to many-to-many field removals
 optimizations in the auto-detector but the additional tests in
 `test_optimizer` demonstrate that changes work as expected. We should
 likely add more tests for the `RemoveField` and `DeleteModel` without
 fields(s) tests but I think this should be a good basis if you want to
 familiarize yourself with the internals of the optimizer.

-- 
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/066.3a8de435151a168c3bae278e731e1355%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-28 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 This is explained in more details in the above links but the crux of the
 issue is that `RemoveField` and `DeleteModel` operations don't hold a
 reference to ''what'' they are removing so
 
[https://github.com/django/django/blob/e65fea9292ffdeb9bb76062f6cb2a5ff514ae969/django/db/migrations/operations/models.py#L268-L271
 they must assume they could be referring to any model].

 In other words, because the `DeleteModel` operation doesn't hold a
 reference to the model state it's removing it cannot differentiate between
 the cases where the optimization can be performed (this ticket's example)
 and when it cannot because there's cycles between models (comment:6).

 You likely can get the optimization working for this ticket by changing
 `DeleteModel.references_model` to return `False` but
 
[https://github.com/django/django/blob/e65fea9292ffdeb9bb76062f6cb2a5ff514ae969/tests/migrations/test_autodetector.py#L2029-L2040
 that I'll break when for the cases where model cycles are deleted in the
 same migration].

 If `DeleteModel` operations were created with the set of fields they have
 at removal time it would be possible for them to properly determine
 whether or not they references each other.

-- 
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/066.db849099ec188c3409a3d9c3ede34a5e%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-28 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sanskar Jaiswal):

 Forgive me if I come off as a bit unaware, I have just started to work
 with the migrations component. I have been going through the code in the
 meanwhile, and I am confident that the `reduce()` method or
 `MigrationOptimizer`'s `optimize_inner()` method is causing the issue.
 Just to be on the same page, the issue here is that while one
 `RemoveField` gets reduced into `DeleteModel`, while the other does not,
 right?

-- 
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/066.552c414aa639c61c0f05bbed7b0c0d07%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-28 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 I'm not sure I understand, the migration file you pointed at clearly has 3
 operations so the ``
 got reduced into the ``.

-- 
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/066.601fef4d1e9eeb654f7e61d53a36e7bf%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-27 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sanskar Jaiswal):

 Unfortunately, I don't think this is the case here. Here is the migration
 file that was generated: https://pastebin.com/nSN5HNW8

-- 
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/066.66e27ac0eb7d48a9185fc76be8d67447%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-27 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 > The method is adding four operations to the generated_operations, but
 only three of them show up in the actual migrations file. Am I missing
 something here?

 Yes. The optimizer is likely able to optimize one of the `RemoveField`
 into its corresponding `DeleteModel` but not the other one. The reduction
 operation takes place in `RemoveField.reduce`.

 See #26720 (https://github.com/django/django/pull/7999) and
 https://code.djangoproject.com/ticket/24424#comment:35 for more details
 about that.

-- 
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/066.86e84ba29277542e595ae46de01c6bb4%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-27 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sanskar Jaiswal):

 Upon doing some more debugging, I found some peculiar behaviour. I tried
 to print `generated_operations` at the end of the function
 `generate_deleted_models's `.  This is the output:  `{'some':
 [, , ,
 ]}`.

 The method is adding four operations to the `generated_operations`, but
 only three of them show up in the actual migrations file. Am I missing
 something here?

-- 
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/066.85cc6a764ab20db417e4abe707aac9ce%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-26 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Sankar it's bit more complicated than that.

 If you remove two interelated models (or any model cycle) at the same time
 fields have to be removed to break the cycle before hand

 Given

 {{{#!python
 class Foo(models.Model):
 bar = models.ForeignKey('Bar')

 class Bar(models.Model):
 foo = models.ForeignKey(Foo)
 }}}

 Removing both models and running `makemigrations` must generate a
 migration that either drop `Foo.bar` or `Bar.foo` before proceeding with
 the model removal. I'm pretty sure we have auto-detector tests for this
 case.

 The optimizer likely need to be adjusted somehow but I doubt
 `generate_deleted_models`'s generation of `RemoveField` is to blame.

-- 
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/066.fa65a269eb208c765d91db9e0e5a4db5%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-26 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sanskar Jaiswal):

 Upon going through some of the source code, the issue clearly arises
 because we are calling `RemoveField` in the `generate_deleted_models`
 method in `db/migrations/autodetector.py`
 
[https://github.com/django/django/blob/f283ffaa84ef0a558eb466b8fc3fae7e6fbb547c/django/db/migrations/autodetector.py#L707].
 I think calling this method here is redundant as `DeleteModel` should drop
 the table from the database which automatically deletes the related fields
 as well. Can someone confirm my hypothesis or correct me if I am steering
 in the wrong direction?

-- 
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/066.8c8ec7e622d008970096e8e02580401a%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields.

2020-02-14 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-+-
 Reporter:  Panagis  |Owner:  Rohit Jha
  Alisandratos   |
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  migration,optimizer  | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Rohit Jha):

 * owner:  nobody => Rohit Jha
 * status:  new => assigned


-- 
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/066.cf297754a08be5f25d736e114b912630%40djangoproject.com.


Re: [Django] #31255: Migrations create a redundant RemoveField operation when deleting 2 models with related fields. (was: Migration optimizer removes 1 RemoveField for FK when deleting 2 models)

2020-02-10 Thread Django
#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
--+
 Reporter:  Panagis Alisandratos  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Migrations|  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  migration,optimizer   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by felixxm):

 * cc: Markus Holtermann, Andriy Sokolovskiy, Shai Berger (added)
 * version:  2.2 => master
 * stage:  Unreviewed => Accepted


Comment:

 IMO, `RemoveField` is redundant in this case (see #24061 with a related
 discussion).

-- 
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/066.3abd4a9e9105954d6357b49b327c211c%40djangoproject.com.