#28053: Allow fields to specify arbitrary indexes via db_index=Index()
-------------------------------------+-------------------------------------
Reporter: Marc | Owner: nobody
Tamlyn |
Type: | Status: new
Uncategorized |
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords: indexes migrations
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Expand `Field.db_index` to allow explicitly setting an index.
Syntax would look something like:
`HStoreField(db_index=GinIndex())`
Changes needed:
- Indexes won't necessarily receive fields initially.
- Fields are responsible for their own indexes. This is tackled here and
has implications for #27859, `_like` indexes on Postgres, and other
situations where we customise the indexes. It is possible, but I'm not
sure, that `Field.get_indexes()` could also handle unique conditions, but
I think it's better kept separately as not all databases consider
uniqueness to be an index.
- Change to `SchemaEditor.alter_field` so it receives the `to_model`, so
that the `Index` can resolve the correct column names. This is extra
important for `db_index` being a functional index (see #26167), although
that's not currently supported in the current data.
--
Ticket URL: <https://code.djangoproject.com/ticket/28053>
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/051.0281a8187459259407f1413f15cee2a2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.