-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace index_together with indexes in CRUDEvent model #258
Conversation
Hm, looks like On Django 3.2 the following operations are created: operations = [
migrations.AlterIndexTogether(
name='crudevent',
index_together=set(),
),
migrations.AddIndex(
model_name='crudevent',
index=models.Index(fields=['object_id', 'content_type'], name='easyaudit_c_object__82020b_idx'),
),
] But this would drop and add the index which is quite an expensive operation. Are there any plans to drop support for older Django versions for newer versions of this package? |
@jheld Can we drop Django 3.2 in a future version? It is going to be end of life soon anyway (April 2024). |
With Django 5 being in beta, is there any chance we can move this forward? I suggest to drop support for older Django versions in a new version which allows this change to be included in a new version. Many Django packages are currently adding support for Django 5.0. What are your thoughts, @jheld? |
I'm not sure I agree that we'd need need to drop any versions of django just because of this proposed change (by itself). If there are unsupported versions that we allow which add cruft to the codebase, certainly, we'd want to make that happen. Regarding unreleased versions of django, we are under no commitment to make that first-class, though I concur being implicitly friendly toward it is fine in the general sense. I would welcome a PR which would gracefully raise the upper django version limit to allow for that. Regarding some parts of this PR, can you check on the build failures, and we can go from there regarding plan for merge? |
1e94d63
to
12bd981
Compare
@jheld Thanks for your quick response. I understand your view. Now that I checked a few packages, it was a bit harsh to suggest dropping support for Django 3.2 right now. The issue in this PR is that the migration operation needed ( Maybe the best way forward is to hold off with this change. Depending on the philosophy of this package regarding supported Django versions it might be best to wait until Django 3.2 reached end of life and do it then. I'll create a separate PR to ensure that the pipeline also runs for Python 3.12 and Django 5.0. |
@jheld See #264 and #265 for Django 5.0 support I just saw that in the Django 5.0, they recommend third-party app authors to drop support for Django < 4.2: https://docs.djangoproject.com/en/5.0/releases/5.0/#third-party-library-support-for-older-version-of-django |
Note that I've solved all of this in #267. I don't see any real concern from having to regenerate the index, it'll just take a little bit of time, but that sort of operation is normal and expected. I created an additional issue for dropping Django <4.2 support, which should be done in April to coincide with Django's schedule. This presents no problem, users on older versions of Django can simply use an older version of |
Thanks for fixing it and creating the extra issue (#269 for reference). |
Created #277 which this PR is dependant on. |
@mschoettle sorry looks like we have some sort of test build failure, can you take a look when you have some time? |
12bd981
to
d31ca33
Compare
@jheld Brought this up to date with |
CRUDEvent
hasMeta.index_together
specified. The use ofindex_together
is deprecated as of Django 4.2 (see https://docs.djangoproject.com/en/4.2/ref/models/options/#index-together).It emits the following warning:
This PR replaces
index_together
withindexes
.Note that as a result the index becomes named:
If desired we can specify a specific name for the index.