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 migration checksum comparison during migrate info #1888

Merged
merged 1 commit into from Jun 10, 2022

Conversation

mdtusz
Copy link
Contributor

@mdtusz mdtusz commented Jun 2, 2022

When running sqlx migrate info, the applied migrations checksums are
compared against the checksums of the local migration files. While the
checksums of applied migrations are stored correctly in the database as
sha384sum values, the migrate info command was incorrectly comparing
these against the checksums of down-migrations in cases where reversible
migrations are being used (e.g. when migrations end in .up.sql and
.down.sql).

This fixes the issue by skipping over any migrations with the
MigrationType::ReversibleDown type, using the same idiom as is used
when running migrations (with migrate run).

Issue introduced in #1680
Partially resolves #1158

@abonander
Copy link
Collaborator

@mdtusz looks like you need to run cargo fmt

@mdtusz mdtusz force-pushed the fix-info-checksum-mismatch branch from 07865b2 to 53276c7 Compare June 4, 2022 06:38
@mdtusz
Copy link
Contributor Author

mdtusz commented Jun 4, 2022

Whoops was working on a different computer and didn't have it set up to run automatically. Should be all good to go now!

When running `sqlx migrate info`, the applied migrations checksums are
compared against the checksums of the local migration files. While the
checksums of applied migrations are stored correctly in the database as
sha384sum values, the `migrate info` command was incorrectly comparing
these against the checksums of down-migrations in cases where reversible
migrations are being used (e.g. when migrations end in `.up.sql` and
`.down.sql`).

This fixes the issue by skipping over any migrations with the
`MigrationType::ReversibleDown` type, using the same idiom as is used
when running migrations (with `migrate run`).

Issue introduced in launchbadge#1680
Partially resolves launchbadge#1158
@mdtusz mdtusz force-pushed the fix-info-checksum-mismatch branch from 53276c7 to 94b3375 Compare June 4, 2022 06:41
@abonander abonander merged commit 664d576 into launchbadge:master Jun 10, 2022
@mdtusz mdtusz deleted the fix-info-checksum-mismatch branch June 10, 2022 22:29
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.

Renaming migrations
2 participants