#28339: Setting db_index=False on a field doesn't actually remove the index
----------------------------------+--------------------------------------
     Reporter:  Craig de Stigter  |                    Owner:  nobody
         Type:  Bug               |                   Status:  closed
    Component:  Migrations        |                  Version:  1.11
     Severity:  Normal            |               Resolution:  invalid
     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 Craig de Stigter):

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


Comment:

 My apologies, this is a case of me not understanding how exactly
 `sqlmigrate` works.

 It appears that maybe Django doesn't know what the index is named ahead of
 time.

 If you `sqlmigrate` a migration that drops an index _without_ actually
 creating the index first in the database, the resulting SQL skips the
 index drop as described above.

 However if you actually create the index first, then the `sqlmigrate`
 connects to the database and inspects the schema to determine which
 indexes have been created. Then the resulting SQL correctly includes the
 index drop.

 This is rather counterintuitive (to me), but perhaps it's the only
 possible way to do it?

 Unfortunately this means I cannot convert autogenerated django migrations
 to SQL up-front.

--
Ticket URL: <https://code.djangoproject.com/ticket/28339#comment:5>
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.54670d825955402e8be4d0afc91dbae5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to