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

Not handling squashes well. #329

Closed
tolomea opened this issue May 16, 2024 · 2 comments · Fixed by #360
Closed

Not handling squashes well. #329

tolomea opened this issue May 16, 2024 · 2 comments · Fixed by #360

Comments

@tolomea
Copy link

tolomea commented May 16, 2024

Python Version

3.10.12

Django Version

4.2.11

Package Version

2.12.0

Description

When there is a squash and that squash includes the most recent migration django-linear-migrations wants the squash to be the migration mentioned in max_migration.txt

Obviously it doesn't do this when the latest migration is not in the squash.

This is regardless of the current migrations state of the DB. That is because the loader isn't given the connection so it can't tell what has been applied which leads it to conclude nothing has been applied and thus all squashes can be used.

@adamchainz
Copy link
Owner

I guess we could override squashmigrations to also update max_migration.txt files. Or, maybe we can load the graph with MigrationLoader(replace_migrations=False).

Do you have any sense of which would be better, or even time to make a PR?

@tolomea
Copy link
Author

tolomea commented May 20, 2024

replace_migrations=False leads to multiple heads which creates further problems
having the squashes in the max_migrations files seems to be otherwise harmless, so maybe having squash update max_migrations is the best path

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 a pull request may close this issue.

2 participants