Skip to content
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

Update django 5.1 #197

Merged
merged 2 commits into from
Aug 22, 2024
Merged

Update django 5.1 #197

merged 2 commits into from
Aug 22, 2024

Conversation

norkans7
Copy link
Contributor

@norkans7 norkans7 commented Aug 21, 2024

once #196 is merged

@norkans7 norkans7 changed the base branch from main to update-deps August 21, 2024 16:37
migrations.AlterIndexTogether(
name="dashblock",
index_together={("org", "is_active", "dashblock_type", "priority")},
migrations.AddIndex(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to adjust these old migrations to not use index_together as that throw the error
TypeError: 'class Meta' got invalid attribute(s): index_together

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that's true.. Django 5.1 still has AlterIndexTogether for backwards compatibility - you just can't use index_together on a model

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I will step through the codes and see why that error is being thrown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to squash migrations before moving to 5.1 so that no index_together is used in historical migrations
https://docs.djangoproject.com/en/5.1/releases/4.2/#index-together-option-is-deprecated-in-favor-of-indexes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rowanseymour even with squashing the migrations we still need to adjust them to not use index_together

19dc98f

No other solution has been provided even on the tickets

https://code.djangoproject.com/ticket/35679

https://code.djangoproject.com/ticket/34856

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think in our case we can just even skip the squash migrations and just adjust the past migrations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And editing the squashed migrations or existing migrations is what is suggested by https://code.djangoproject.com/ticket/34525#comment:17

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh... ok then sorry I was wrong about that.. I think go ahead and manually tweak old migrations if that's the easiest way forward

@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.33%. Comparing base (8bb30aa) to head (d1c17e3).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #197   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files          29       29           
  Lines        1845     1845           
=======================================
  Hits         1722     1722           
  Misses        123      123           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@norkans7 norkans7 changed the base branch from update-deps to start-squash-migrations-5.0.8 August 22, 2024 10:13
@norkans7 norkans7 changed the base branch from start-squash-migrations-5.0.8 to update-deps August 22, 2024 14:45
Base automatically changed from update-deps to main August 22, 2024 14:52
@norkans7 norkans7 marked this pull request as ready for review August 22, 2024 14:52
@norkans7 norkans7 merged commit 3566991 into main Aug 22, 2024
14 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.

3 participants