Opened 8 years ago

Closed 3 years ago

Last modified 3 years ago

#5805 closed New feature (fixed)

Specify multicolumn indexes.

Reported by: Stavros Korokithakis <stavros@…> Owned by: Alex
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: index multicolumn indexes database dceu2011
Cc: fnl, martin.paquette@…, diegobz, mpessas, jeffrey@…, gert.vangool@…, mike@…, Gillingham@…, charette.s@…, ivan_virabyan, dbrgn Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It would be good if we could specify multicolumn indexes to be created in the model, sort of like unique_together but for index_together. I am not familiar with a way to do this currently, hence this feature request.

Attachments (1)

index_together.diff (7.1 KB) - added by jgelens 4 years ago.
Updated patch to match trunk

Download all attachments as: .zip

Change History (26)

comment:1 Changed 8 years ago by Simon G <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Dupe of #373, which is pending the queryset rewrite/refactor I believe..

comment:2 Changed 6 years ago by matclayton

  • Resolution duplicate deleted
  • Status changed from closed to reopened

#373 is for multi column primary keys, not indexes.

comment:3 Changed 6 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 6 years ago by fnl

  • Cc fnl added

comment:5 Changed 4 years ago by gabrielhurley

  • Severity set to Normal
  • Type set to New feature

comment:6 Changed 4 years ago by martinpaquette

  • Cc martin.paquette@… added
  • Easy pickings unset

comment:7 Changed 4 years ago by diegobz

  • Cc diegobz added

comment:8 Changed 4 years ago by mpessas

  • Cc mpessas added

comment:9 Changed 4 years ago by jgelens

  • Cc jeffrey@… added

comment:10 Changed 4 years ago by jgelens

  • Keywords dceu2011 added
  • Owner changed from nobody to jgelens
  • Status changed from reopened to new
  • UI/UX unset

comment:11 Changed 4 years ago by jgelens

  • Has patch set

Added a patch with docs and simple test. Which I tested on MySQL, PostgreSQL and SQLite

comment:12 Changed 4 years ago by jgelens

  • Needs tests set
  • Status changed from new to assigned

We still need to check if the indexes are being created. For this we need better database introspection for indexes. For this #16220 will need to be fixed first. Till that moment, this ticket is on hold.

comment:13 Changed 4 years ago by gvangool

  • Cc gert.vangool@… added

comment:14 Changed 4 years ago by carbonXT

  • Cc mike@… added

Changed 4 years ago by jgelens

Updated patch to match trunk

comment:15 Changed 4 years ago by Gillingham@…

  • Cc Gillingham@… added

comment:16 Changed 3 years ago by charettes

  • Cc charette.s@… added

comment:17 Changed 3 years ago by aaugustin

#18092 was closed as a duplicate and has a patch.

comment:18 Changed 3 years ago by ivan_virabyan

  • Cc ivan_virabyan added

comment:19 Changed 3 years ago by dbrgn

  • Cc dbrgn added

comment:20 Changed 3 years ago by mmfunkyd@…

I hope it's not too late to get this into 1.5. This functionality would be extremely nice as a complement to the db_index functionality currently in Django.

comment:21 Changed 3 years ago by jgelens

The patch was working fine for trunk 10 months ago. Only tests couldn't be written because of the broken django DB introspection (see related ticket).

comment:22 Changed 3 years ago by Alex

  • Owner changed from jgelens to Alex
  • Status changed from assigned to new

comment:24 Changed 3 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

comment:25 Changed 3 years ago by Alex Gaynor <alex.gaynor@…>

In 6f716e9e5f8f373f48b59791b80f0d68ce9e5bd2:

[1.5.x] Fixed #5805 -- it is now possible to specify multi-column indexes. Thanks to jgelens for the original patch. Backport of 4285571c5a9bf6ca3cb7c4d774942b9ae5b537e4.

Note: See TracTickets for help on using tickets.
Back to Top