#23452: Infinite migrations with empty unique_together
----------------------------+---------------------------------------
Reporter: fwkroon | Owner: Markush2010
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------------------------
Changes (by Markush2010):
* cc: info+coding@… (added)
* status: new => assigned
* owner: nobody => Markush2010
Comment:
First of all, this also affects the `index_together` option.
I'm working on a pull-request. Not sure though, which way I should go.
Here's what's happening:
The `CreateModel` doesn't include those two options at all but adds them,
if they evaluate to `True` (`if model_state.options.get('unique_together',
None)`) as separate operations. Thus an empty `unique_together`
declaration is never added initially. The `AlterUniqueTogether` or
`AlterIndexTogether` on the other side are added if the given value (`()`
is different to `None`).
We now have two options:
1. Always add an `AlterUniqueTogether` or `AlterIndexTogether` operation,
even if it's empty (`()`).
2. Never add an `AlterUniqueTogether` or `AlterIndexTogether` operation if
it's empty (`()`).
I'd go with 2.
--
Ticket URL: <https://code.djangoproject.com/ticket/23452#comment:2>
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/065.095207fbee4b60e31cd8f643bf5f783c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.