#28646: Migration calls "CREATE INDEX" when one already exists when 'unique'
field
attribute is added (PostgreSQL)
-------------------------------------+-------------------------------------
Reporter: Hari - 何瑞理 | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
postgresql,migration,index,#djangocph|
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):
* keywords: postgresql,migration,index =>
postgresql,migration,index,#djangocph
Comment:
I'm going to mark this for #djangocph for the sprint in Copenhagen.
Whilst it's right in the heart of the migration framework, I think it
should be an easy fix.
Here's the GitHub permalink to the problem `if` check:
https://github.com/django/django/blob/fb8fd535c0f47cffb4da0c5900f3f66e1ec8d432/django/db/backends/postgresql/schema.py#L124-L126
If you apply the original suggested fix you get a small number of failures
(3 I think). These relate to needing to add an index due to a `unique`
flag being added. That's the last `or` in the problem `if`.
The test from https://github.com/django/django/pull/9438 checks the new
problem behaviour. (Can it live with the tests that fail if you apply the
suggested fix?)
That new test fails because the `unique` property is essentially `_unique
or primary_key`, which is too wide. As I said above, using
`new_field._unique` was enough to make the test pass.
The task here is to go through that and make sure it's correct. Make sure
the test is in the right place. Add a comment in the code (if it's
needed). Maybe a release note etc.
--
Ticket URL: <https://code.djangoproject.com/ticket/28646#comment:10>
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/066.471d33eb2d48d82ca3ff163defc1d99c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.