#27064: Implement RenameIndex in a backwards compatible way
-----------------------------------------+------------------------
Reporter: MarkusH | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 1 | Needs tests: 1
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In order to eventually deprecate `index_together` we need a way to deal
with old projects that have unnamed indexes. This proves to be a non-
trivial problem. Andrew and I came up with these things to consider.
* `RenameIndex(model, new_name, old_name=None, old_fields=None)` where
exactly one of `old_name` and `old_field` is given (`old_name ^
old_fields`)
* If the old_name is given we use `RENAME INDEX` if available
* Otherwise look at the state and drop existing indexes and create new the
index with new name
* On MySQL (or other DBs) that don't support `RENAME INDEX`, provide SQL
query to look up index name from information_schema by field names and
pass in to `DROP INDEX`.
* If more than one index is found while identifying with field names,
migrations must error out with an `AmbiguityError`
* If the autodetector finds an old, unnamed index and a new, named one
matching field signature, issue a `RenameIndex` operation
* For backwards operations with unnamed old indexes, `RenameIndex` is a
noop.
--
Ticket URL: <https://code.djangoproject.com/ticket/27064>
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.28989f43886146f976cdc9e9f226589d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.