#27738 closed Bug (wontfix)
Default index name not set outside of migrations
Reported by: | Mads Jensen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.10 |
Severity: | Normal | Keywords: | db-indexes |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If an index is added outside of the migration-system, then the name will default to the empty string. This can be reproduced in the test suite by removing the name-argument to the constructor of either BrinIndex
or GinIndex
.
django/models/base.py
calls set_set_name_with_model
. Perhaps this call could be moved to Index
instead?
Change History (4)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
I suppose it may be an obscure case, so maybe closing this as "works for me" or "some day/maybe" would be fine.
comment:3 by , 8 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
comment:4 by , 8 years ago
name
is supposed to be a required argument when you define an index in _meta.indexes
. However, for backwards compatibility reasons with auto-generated index names for e.g. db_index=True
and index_together
the name cannot be set during object creation but needs to be patched in later while running migrations.
What's the use case for adding indexes without using migrations and how is it done? I'm not sure if this should be supported.