#28339: Setting db_index=False on a ForeignKey doesn't actually remove the index
--------------------------------------------+------------------------
Reporter: Craig de Stigter | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
1. Make a `ForeignKey`. Don't specify a value for `db_index` (django sets
it to `True` by default)
2. Make a migration for the foreignkey. This creates an index:
{{{
#!sql
CREATE INDEX "a_c_b_id_5a026661" ON "a_c" ("b_id");
}}}
3. Explicitly set `db_index=False` and create another migration
4. Check `sqlmigrate` for the new migration. Index is never actually
removed:
{{{
#!sql
BEGIN;
--
-- Alter field b on c
--
COMMIT;
}}}
One note: This is with postgres settings. I'm not sure if it's db-specific
--
Ticket URL: <https://code.djangoproject.com/ticket/28339>
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/050.35e2c246746ef0f4f2e594a474b7aa99%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.