-
-
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
Use MigrationLoader to order migrations #208
Conversation
src/django_linear_migrations/apps.py
Outdated
plan = [] | ||
for node in nodes: | ||
for migration in loader.graph.forwards_plan(node): | ||
if migration not in plan: | ||
plan.append(migration) | ||
return plan |
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.
its just a copy of https://github.com/django/django/blob/main/django/db/migrations/graph.py#L306 (with passing at_end=True
)
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.
I'd feel more comfortable calling the method in Django, even if it is private.
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.
ok, i will use typing.cast to avoid Any
Looks like a good start. (Please don't create draft PR's if you want them looked at, "draft" normally means "don't look at this".) In the issue I noted we'd need to call The test run failures are due to lack of Will you keep working on this? |
Yea, i am going to rewrite tests. |
8b83882
to
e6a5891
Compare
I've added |
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.
Just getting round to this now after a busy end of 2022...
Please, whenever you open an open source PR, update the documentation and add a changelog note.
src/django_linear_migrations/management/commands/create_max_migration_files.py
Outdated
Show resolved
Hide resolved
What do you think about adding a new flag to provide the db name instead of using always DB_DEFAULT_ALIAS in MigrationLoader? |
It seems we can use |
Released in 2.6.0, thanks! |
Fix #161
What do you think @adamchainz? It also seems using MigrationLoader needs proper fake migrations (with
Migration
class, not just empty files)