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

fix(migrations): fix migrations with targets that are out of bounds #274

Merged
merged 3 commits into from
Dec 7, 2021

Conversation

samuelmasse
Copy link
Contributor

Fixes a bug where asking the server to migrate up to a version lower than the current server version, or migrate down to a version higher than the current server version, would result in 0 migrations getting run and the server version getting wrongly updated in the meta table

Closes DEV-2137

@linear
Copy link

linear bot commented Dec 3, 2021

DEV-2137 Fix messaging migration system allowing to up migrate to a lower version

This is a loophole in the migration system. You can ask to migrate up to a lower version, and the migration system will always succeed change the server version to the target version even if it didn't run the required migrations

Copy link
Contributor

@laurentlp laurentlp left a comment

Choose a reason for hiding this comment

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

So if you do an up migration to a version (v1.5.6) higher than the latest one, will it save v1.5.6 in the meta table? Same goes for the down migration.

Also, can you make sure to update the PR title so it better reflects what is this fix

@samuelmasse
Copy link
Contributor Author

@laurentlp Good point I added a check to prevent migration to a version higher than the version of the server's package.

@samuelmasse
Copy link
Contributor Author

For the down migration, you could technically migrate down to 0.0.0 but that wouldn't cause any missing migration so it's correct behavior

@samuelmasse samuelmasse changed the title fix(migrations): fix bugs fix(migrations): fix migrations with targets that are out of bounds Dec 6, 2021
@samuelmasse samuelmasse merged commit c0e7a50 into master Dec 7, 2021
@samuelmasse samuelmasse deleted the sm-fix-migrations branch December 7, 2021 16:21
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.

None yet

2 participants