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

Support makemigrations --update from Django 4.2 #270

Merged
merged 5 commits into from
Jul 3, 2023

Conversation

elliott-omosheye
Copy link
Contributor

Here https://github.com/django/django/pull/15669/files#diff-f2db49f63db7e5553ce472afe234288b31f1862e10b3406b58ac537ed742ffc6R330
Django 4.2 added an optional kwarg to write_migration_files based on the --updated flag.

Copy link
Owner

@adamchainz adamchainz left a comment

Choose a reason for hiding this comment

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

Nice update. Please add tests and a changelog note.

Comment on lines 16 to 20
if update_previous_migration_paths:
super().write_migration_files(changes, update_previous_migration_paths)
else:
super().write_migration_files(changes)
Copy link
Owner

Choose a reason for hiding this comment

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

better to avoid the else clause with an explicit Django version check: if django.VERSION >= (4, 2): ...

Django 4.2 added an optional kwarg to write_migration_files based on the --updated flag
@elliott-omosheye
Copy link
Contributor Author

added a test but not sure what you want in the changelog

@adamchainz
Copy link
Owner

Updating django-stubs for the type-checking failure: typeddjango/django-stubs#1609

@adamchainz
Copy link
Owner

added a test but not sure what you want in the changelog

I've written one for you. In future refer to past PR's and changelog entries to see for yourself.

@adamchainz adamchainz changed the title Update to support django 4.2 --updated flag Support makemigrations --update from Django 4.2 Jul 3, 2023
@adamchainz adamchainz enabled auto-merge (squash) July 3, 2023 13:03
@adamchainz adamchainz merged commit 5ce5f4f into adamchainz:main Jul 3, 2023
@@ -43,6 +46,21 @@ def test_creates_max_migration_txt(self):
max_migration_txt = self.migrations_dir / "max_migration.txt"
assert max_migration_txt.read_text() == "0001_initial\n"

@unittest.skipUnless(django.VERSION >= (4, 2), "--update added in Django 4.2")
Copy link
Owner

Choose a reason for hiding this comment

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

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