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
Found bug in migration checksum #1887
Comments
Hi @bryanmcgrane! Good catch, thanks for reporting this, I'll look into it asap. We'll have to be careful to still accept the bad checksums for now, unfortunately (while fixing the new ones), or it will break existing users. |
This is to align with other tools, for example the CLI shasum utility on linux. The old format is still recognized and accepted for compatibility with existing migration tables. closes #1887
PR is here: #1889 I think we should merge after next release (Tuesday), since current checksums aren't completely broken, and that will give us some time to test before releasing that change to users. |
This is to align with other tools, for example the CLI shasum utility on linux. The old format is still recognized and accepted for compatibility with existing migration tables. closes #1887
This is to align with other tools, for example the CLI shasum utility on linux. The old format is still recognized and accepted for compatibility with existing migration tables. closes #1887
This is to align with other tools, for example the CLI shasum utility on linux. The old format is still recognized and accepted for compatibility with existing migration tables. closes #1887
I noticed there is an issue with the checksum generation code found here:
prisma-engines/migration-engine/connectors/migration-connector/src/lib.rs
Line 88 in c1113c6
I noticed the issue when inspecting the _prismia_migration tables that are generated in my database.
It appears there is an issue with converting from the bytes to a hex string, where 0's are sometimes being stripped out of the final checksum string. It's relatively simple to replicate the issue. Below is an example (apologies in advance, I'm not a Rust developer):
Characters that are missing from Prisma's checksum
2cf24dba5fb0a3
0
e26e83b2ac5b9e29e1b161e5c1fa7425e730
43362938b9824Edit:
I dug a little deeper and I found the issue was with this line where bytes are converted to hex strings.
prisma-engines/migration-engine/connectors/migration-connector/src/lib.rs
Line 110 in c1113c6
write!(checksum_string, "{:x}", byte).unwrap();
needs to have a 0 padding built in for bytes with leading 0's.The text was updated successfully, but these errors were encountered: