[Django] #26808: Support adding class based indexes from Meta class

4 views
Skip to first unread message

Django

unread,
Jun 27, 2016, 12:05:55 PM6/27/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
----------------------------------------------+------------------------
Reporter: akki | Owner: akki
Type: New feature | Status: new
Component: Database layer (models, ORM) | Version: master
Severity: Normal | Keywords: db-indexes
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+------------------------
Now that class based indexes are for real and can be added via migration
files using `AddIndex` operation, we should allow index addition from
`Meta` class as well.

Users will then be able to create indexes by defining something like the
following in their models:

{{{
#!python

class Meta:
indexes = [
models.Index(fields=['foo', 'bar'], name='my_index_name_idx')
]

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26808>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 27, 2016, 12:57:32 PM6/27/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
-------------------------------------+-------------------------------------

Reporter: akki | Owner: akki
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: db-indexes | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26808#comment:1>

Django

unread,
Jul 3, 2016, 3:02:24 AM7/3/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
-------------------------------------+-------------------------------------

Reporter: akki | Owner: akki
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: db-indexes | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Markus Holtermann <info@…>):

In [changeset:"f7e00b40c558967d697529b7ed55c5fb82396e6d" f7e00b40]:
{{{
#!CommitTicketReference repository=""
revision="f7e00b40c558967d697529b7ed55c5fb82396e6d"
Refs #26808 -- Avoided clashing keyword arguments in test_autodetector

Factor method signatures in test_autodetector to avoid clashing keyword
arguments when introducing indexes.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26808#comment:2>

Django

unread,
Jul 3, 2016, 7:46:48 AM7/3/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
-------------------------------------+-------------------------------------
Reporter: akki | Owner: akki
Type: New feature | Status: assigned

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: db-indexes | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by akki):

* status: new => assigned
* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/6857

--
Ticket URL: <https://code.djangoproject.com/ticket/26808#comment:3>

Django

unread,
Aug 2, 2016, 9:11:08 AM8/2/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
-------------------------------------+-------------------------------------
Reporter: akki | Owner: akki

Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: db-indexes | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by edmorley):

* cc: emorley@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/26808#comment:4>

Django

unread,
Aug 5, 2016, 8:12:34 AM8/5/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
-------------------------------------+-------------------------------------
Reporter: akki | Owner: akki

Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: db-indexes | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26808#comment:5>

Django

unread,
Aug 5, 2016, 6:16:01 PM8/5/16
to django-...@googlegroups.com
#26808: Support adding class based indexes from Meta class
-------------------------------------+-------------------------------------
Reporter: akki | Owner: akki
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: db-indexes | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"6a8372e6ec42eb50e05f9dbcb26b783237bdc233" 6a8372e]:
{{{
#!CommitTicketReference repository=""
revision="6a8372e6ec42eb50e05f9dbcb26b783237bdc233"
Fixed #26808 -- Added Meta.indexes for class-based indexes.

* Added the index name to its deconstruction.
* Added indexes to sqlite3.schema._remake_table() so that indexes
aren't dropped when _remake_table() is called.

Thanks timgraham & MarkusH for review and advice.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26808#comment:6>

Reply all
Reply to author
Forward
0 new messages