Skip to content

Conversation

dishn
Copy link
Contributor

@dishn dishn commented Sep 18, 2024

Django 5.1 removes index_together from Model.Meta and there exist a condition in schema.py that uses index_together. This pr aims to fix the deprecation and keep it compatible with prior django versions as well

if (
any(field.db_index for field in model._meta.local_fields)
or model._meta.index_together
or any(len(index.fields) > 1 for index in model._meta.indexes)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly defined indexes are allowed, you don't need to check model._meta.indexes.

Change this to or getattr(model._meta, "index_together", None) and delete line 220-223

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@dishn dishn force-pushed the fix-index-together branch from d67ab51 to d3b39a4 Compare September 25, 2024 13:15
@dishn dishn force-pushed the fix-index-together branch from d3b39a4 to 7ab46d6 Compare September 25, 2024 13:20
@dishn
Copy link
Contributor Author

dishn commented Sep 25, 2024

@jayvynl Do the failed tests require any of my work?

@jayvynl
Copy link
Owner

jayvynl commented Sep 26, 2024

I will fix this.

@jayvynl jayvynl merged commit 1f1eefb into jayvynl:main Sep 27, 2024
1 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants