10000 Upgrade to Django 5.2 by AyushDharDubey · Pull Request #9 · fossgis/3dmr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Upgrade to Django 5.2 #9

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

Merged
merged 12 commits into from
Jun 11, 2025
Merged

Conversation

AyushDharDubey
Copy link
Contributor

Description:

This major upgrade transitions our codebase from Django 2.0.5 to 5.2:

  • Python Upgrade: 3.6 -> 3.12

  • Django Upgrade: 2.0.5 -> 5.2

    • Addressed all deprecated methods and settings (e.g., middleware changes, url() to re_path(), etc.).
    • Updated settings where required (like DEFAULT_AUTO_FIELD and related flags).
  • Migration Trickiness (AutoField -> BigAutoField) (This was a tricky one and worth noting explicitly)

    • Django 5.2 uses BigAutoField by default for primary keys, but older migrations were based on AutoField.
    • Changing the default caused migration blockage, due to materialized views not being modifiable.
    • Since materialized views don’t support full migrations cleanly, I worked around it by:
      • Dropping the pg_view tables temporarily. (0002)
      • Applying schema changes (with BigAutoField). (0003)
      • Recreating the pg_views and refreshing them to repopulate data from the parent tables. (0004)
    • This ensured both schema fixes and data integrity.
  • OAuth2 Fixes

  • GitHub Actions Upgrade


PS

While the migration is working well on my local and has been tested manually with sample model entries, we must make sure to back up the production database before running these migrations, especially given the manual materialized view handling. That being said, it’s unlikely to cause data loss.

Copy link
Collaborator
@lonvia lonvia left a comment

Choose a reason for hiding this comment

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

Quite a few changes but indeed nicely straightforward. Looks mostly good to me. I've just added some minor observations.

I can test the migrations on a copy of the production system but only in two weeks time. I think it is okay to merge before that. Let me know if you prefer to wait.

@AyushDharDubey
Copy link
Contributor Author

I think it is okay to merge before that.

Since the changes have been tested and look stable to me, I’m fine with merging now; I don’t anticipate any issues.
We can always follow up if anything unexpected comes up. Thanks for the review!

@lonvia lonvia merged commit fedcd9c into fossgis:main Jun 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0