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

feat: make sql code hash independent from CR/LF line endings and leading/traiing spaces #344

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions refinery/tests/rusqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ mod rusqlite {
assert_eq!("initial", migrations[0].name());
assert_eq!("add_cars_table", applied_migrations[1].name());

assert_eq!(2959965718684201605, applied_migrations[0].checksum());
assert_eq!(8238603820526370208, applied_migrations[1].checksum());
assert_eq!(1002061374193754426, applied_migrations[0].checksum());
assert_eq!(17421455799783963888, applied_migrations[1].checksum());
}
#[test]

Expand Down Expand Up @@ -385,8 +385,8 @@ mod rusqlite {
assert_eq!("initial", migrations[0].name());
assert_eq!("add_cars_table", applied_migrations[1].name());

assert_eq!(2959965718684201605, applied_migrations[0].checksum());
assert_eq!(8238603820526370208, applied_migrations[1].checksum());
assert_eq!(1002061374193754426, applied_migrations[0].checksum());
assert_eq!(17421455799783963888, applied_migrations[1].checksum());
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion refinery_core/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Migration {
let mut hasher = SipHasher13::new();
name.hash(&mut hasher);
version.hash(&mut hasher);
sql.hash(&mut hasher);
sql.lines().for_each(|line| line.trim().hash(&mut hasher));
let checksum = hasher.finish();

Ok(Migration {
Expand Down
Loading