From 311a8e8d505049ff5644a94e16c00246c8a43a18 Mon Sep 17 00:00:00 2001 From: Akshesh Date: Fri, 22 Jul 2016 18:22:44 +0530 Subject: Fixed #20888 -- Added support for column order in class-based indexes. --- docs/ref/models/indexes.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'docs/ref/models') diff --git a/docs/ref/models/indexes.txt b/docs/ref/models/indexes.txt index b63e86517c..ac2839bbd4 100644 --- a/docs/ref/models/indexes.txt +++ b/docs/ref/models/indexes.txt @@ -34,6 +34,20 @@ options`_. A list of the name of the fields on which the index is desired. +By default, indexes are created with an ascending order for each column. To +define an index with a descending order for a column, add a hyphen before the +field's name. + +For example ``Index(fields=['headline', '-pub_date'])`` would create SQL with +``(headline, pub_date DESC)``. Index ordering isn't supported on MySQL. In that +case, a descending index is created as a normal index. + +.. admonition:: Support for column ordering on SQLite + + Column ordering is supported on SQLite 3.3.0+ and only for some database + file formats. Refer to the `SQLite docs + `_ for specifics. + ``name`` -------- -- cgit v1.3