Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#23880 closed Bug (fixed)

SQLite's schema editor doesn't handle index_together

Reported by: Markus Holtermann Owned by: Markus Holtermann
Component: Database layer (models, ORM) Version: 1.7
Severity: Release blocker Keywords:
Cc: Markus Holtermann Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The SQLite schema editor doesn't handle index_together changes. This manifests itself when renaming a field that is part of index_together.

I came across the bug when fixing https://code.djangoproject.com/ticket/23859#comment:6 . After RenameField's database_forwards() has run the index is missing.

Traceback (most recent call last):
  File "/home/jenkins/workspace/django-pull-requests/database/sqlite3/python/python3.4/tests/migrations/test_operations.py", line 1016, in test_rename_field
    self.assertIndexExists("test_rnfl_pony", ["weight", "blue"])
  File "/home/jenkins/workspace/django-pull-requests/database/sqlite3/python/python3.4/tests/migrations/test_base.py", line 46, in assertIndexExists
    for c in connection.introspection.get_constraints(cursor, table).values()
AssertionError: True != False

Change History (6)

comment:1 Changed 6 years ago by Tim Graham

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Markus Holtermann

Owner: changed from nobody to Markus Holtermann
Status: newassigned

comment:3 Changed 6 years ago by Markus Holtermann

Has patch: set

comment:4 Changed 6 years ago by Loic Bistuer

Triage Stage: AcceptedReady for checkin

LGTM

comment:5 Changed 6 years ago by Loic Bistuer <loic.bistuer@…>

Resolution: fixed
Status: assignedclosed

In d2202ec2d4d0477b682c6d0051f27ab4843ef89f:

Fixed #23880 -- Added missing index_together handling for SQLite

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

In ba3e97618696bdd68e4ac9b2220f58e6b3d15bd4:

[1.7.x] Fixed #23880 -- Added missing index_together handling for SQLite

Backport of d2202ec2d4d0477b682c6d0051f27ab4843ef89f from master

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