-
Notifications
You must be signed in to change notification settings - Fork 185
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
Any plans to release v1.3.7 with support for Django 5.1? #301
Comments
Great question. I've just released 1.3.7.b3 (1.3.7.b2 includes a version syntax error) which intends to broaden the django support from >=4.2, <6.0 and I am hoping helps get around the issue you were seeing. |
FWIW, I'm still getting the No other instances of |
Which django version are you on now? I might not be able to check into this more short term but perhaps @mschoettle has any ideas? |
On Django 5.1. If I downgrade to back 5.0.8, there's no problem (same as v1.3.6). |
@djch can you please provide the full stack trace of the error you are getting? |
@mschoettle @jheld I'm having no issues anymore, thanks! Despite of that, I'd really like to know if there's any projection on when 1.3.7 will be released i.e. not beta. It's a little hard to pitch an update based on beta versions. |
Well, actually, I just faced the same issue @djch experienced. Tracked it down to the migration 0004. I saw a squashed 0004 migration there which should replace the original 0004, but Django still loads that migration, it seems. I placed a debugger there to make sure, it got hit. I'm being able to run everything that don't trigger that migration, so I can start the server and run manage commands. This is happening solely when I run tests, I assume because the database gets built from scratch, so it goes through all migrations. If you kept the original migrations concerned they'd be needed, you don't need to worry. As long as the squash migration reaches the exact same state as the other combined and they're referenced at the |
Sounds like @scribejourdan probably has the right of the situation. That being said, I just updated Django to 5.1 again to confirm and now I don't get the error... 🥲 I can say I'm pretty sure I was running |
@scribejourdan I filed the issue as #303 and introduced PR #304 to fix it. Verified myself that it works. It's caused by already having partially migrated, but not past 0019. |
I had a look and thought about this a bit and figured the following out: We squashed the migration(s) with the (at the time) deprecated Are people on here experiencing this issue using Django 5.1 already in production or is this when testing the upgrade to 5.1? If it is the latter, a solution would be to first upgrade /cc @jheld |
Production flow should actually work fine. The problem I'm having is with running tests on CI. Django creates a database from scratch and loads those migration files, even if not actually running them, and fails with that error. |
I cannot reproduce this. Tried it on our project with Django==5.1 and django-easy-audit==1.3.7b3 and pytest runs without an error related to migrations in CI. I also tried a minimal reproduction: docker run --rm -it python:3.12-alpine sh
mkdir app
cd app
pip install Django==5.1
pip install django-easy-audit==1.3.7b3
django-admin startproject test .
# add easyaudit to INSTALLED_APPS in test/settings.py
python manage.py showmigrations
python manage.py migrate Output of showmigrations
Output of migrate
|
Interesting. I'll have it tested again tomorrow and bring a stack trace of how Django reaches that code. Thanks! |
Happy to make the proper release soon-ish (if we determine the risk is quite low or if we determine a patch). Given the issue we're seeing though, I'm kind of happy that it is not the next official release yet! |
Didn't have time to trigger the error today, day was pretty packed. The fix is just to remove the squashed migrations, though. There's no need to keep them around once there's a squash migration to replace them. Django warns to keep them around until it's deployed in all environments, but that doesn't take Git into account. We can bring them back if we need. |
@scribejourdan @mschoettle what was the consensus on accepting this PR? |
The operation that adds the index needs to be removed given that the name was added during index creation. IIRC, that's set at migration 0018. |
@scribejourdan Which Django version are you using? And how do you execute the tests? Please also show the output of |
The Django version is 5.1. I run tests via Django's The
It won't be able to partially apply the squash migration. Wondering what to do with that. |
And the installed easy audit version is? Try |
Great! It would only be a problem if the migrations are not applied to the latest one(s) (i.e., the migration that squashes the old ones). @jheld My recommendation is to release a version that does not work with Django 5.1 first (so based off of 1.3.7b2) to force people to upgrade the migrations and be on the squashed one. Then we can release a new version that supports Django 5.1 and could even remove all the old migrations that were squashed. This is as per the recommendation by Django, see my comment in detail here: #285 (comment) |
I'm heavily against any solution where upgrading immediately to the latest django 5.1+ and |
I just tested and can confirm that The PR from @PaarthShah (#304) should be safe to be merged. A caveat I can think, though, is that we don't need the squashed migration in that scenario given that I don't know how it behaves on partially applied migrations. |
@jourdanrodrigues I can answer that: If a system has partially-applied migrations, (aka is in the middle of what was squashed), then it is forced to use the operations of the unsquashed migrations (but afterwards, will show that the squashed migration has run). Squashing a migration is asserting that every action in it is equivalent to running all of the individual ones, on systems that started from scratch. Squashed migrations can thus "elide" (skip) data migrations (including RunPython migrations marked as Tldr: as long as the unsquashed migrations remain, it's safe. But we CANNOT remove the squashed one either, as anyone who has installed the beta (or from my branch) would then be screwed too). |
@PaarthShah Thanks! |
I agree. And the intention of my comment was to outline a process that prevents that. Is there any scenario that you see where this is not guaranteed to work? |
Regarding this bit below: there should not be a 2-step upgrade process. There should only be a single new version, that supports django 5.1 (and has both the squashed and unquashed migrations). There's been no need to update to the latest for any other reason other than django 5.1 support. A fast-follow version can make no changes other than removing the squashed migration, and can be upgraded to freely. New features, if they come, will come after this, and inherently depend on people being on 5.1
|
The process I outlined is what the Django documentation on squashing migrations recommends:
Unfortunately this did not happen before 5.1 was released.
No. This package still supports Django versions before 5.1 (>= 4.2). |
Hey @jheld sorry to bother, but do you have any idea on when we'd be able to move forward with the upgrade? |
Just waiting on PR #304 . If you are open to forking their change, rebase and resolve conflicts, please do. I've just reached out to them on the PR though so maybe give them a few days, and if see not by mid-week. |
I'll be able to get to it by tomorrow, just will do a rebase |
@jheld done |
new release |
OK, |
@jheld Thanks! Is the "What's Changed" list on the release compiled automatically? Otherwise a complete list including what has been released in the betas, RCs might be helpful to include. |
I debated a bit about whether to include based on the last official release or not. But to dispel confusion, I concur, I'll change it! |
Thank you so much, all! |
I'm trying to upgrade Django to 5.1 but I'm unable because this package triggers an
indexed_together
exception on ver sion 1.3.6.Additionally, on version 1.3.7b1, poetry throws this error:
The text was updated successfully, but these errors were encountered: