#27165 closed Cleanup/optimization (fixed)

CreateModel without indexes always includes options={'indexes': []}

Reported by: Tim Graham Owned by: Akshesh Doshi
Component: Migrations Version: master
Severity: Normal Keywords: 1.11
Cc: Akshesh Doshi Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you create a model without any indexes, the CreateModel operation always includes:

options={
    'indexes': [],
},

It would be nice to avoid that, if possible.

Change History (6)

comment:1 Changed 20 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 20 months ago by Akshesh Doshi

A related comment (and the place where not having this default would cause problems) - https://github.com/django/django/pull/6726#discussion-diff-66307466

comment:3 Changed 20 months ago by Claude Paroz

For me, having indexes=[] in ModelState or in migration files is not necessary the same thing. I didn't explore further, though.

comment:4 Changed 19 months ago by Akshesh Doshi

Owner: changed from nobody to Akshesh Doshi
Status: newassigned

Ahh, I see. I should be able to remove it from the migrations file.

comment:6 Changed 19 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 358c6f21:

Fixed #27165 -- Removed unnecessary CreateModel(... 'indexes': []) in migrations.

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