-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
There was a problem hiding this 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.
if update_previous_migration_paths: | ||
super().write_migration_files(changes, update_previous_migration_paths) | ||
else: | ||
super().write_migration_files(changes) |
There was a problem hiding this comment.
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
6e64cd1
to
4bd328f
Compare
for more information, see https://pre-commit.ci
added a test but not sure what you want in the changelog |
src/django_linear_migrations/management/commands/makemigrations.py
Outdated
Show resolved
Hide resolved
Updating django-stubs for the type-checking failure: typeddjango/django-stubs#1609 |
I've written one for you. In future refer to past PR's and changelog entries to see for yourself. |
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had an idea: adamchainz/django-upgrade#364
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.