Skip to content
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.1] - 2026-04-15
### Changed
- Support `rusqlite` 0.38.x. [#410](https://github.com/rust-db/refinery/pull/410)
### Fixed
- Avoid warning logs for nested directories while scanning migrations. [#421](https://github.com/rust-db/refinery/pull/421)

## [0.9.0] - 2025-01-06
### Added
- Support for TLS in postgres/tokio-postgres using native-tls. [#353](https://github.com/rust-db/refinery/pull/353)
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int8-versions = ["refinery/int8-versions"]

[dependencies]
refinery = { path = "../refinery", features = ["rusqlite"] }
rusqlite = "0.37"
rusqlite = "0.38"
barrel = { version = "0.7", features = ["sqlite3"] }
log = "0.4"
env_logger = "0.11"
2 changes: 1 addition & 1 deletion refinery_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ url = "2.0"
walkdir = "2.3.1"

# allow multiple versions of the same dependency if API is similar
rusqlite = { version = ">= 0.23, <= 0.37", optional = true }
rusqlite = { version = ">= 0.23, <= 0.38", optional = true }
postgres = { version = ">=0.17, <= 0.19", optional = true }
native-tls = { version = "0.2", optional = true }
postgres-native-tls = { version = "0.5", optional = true}
Expand Down
34 changes: 30 additions & 4 deletions refinery_core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ pub fn find_migration_files(
.filter_map(Result::ok)
.map(DirEntry::into_path)
// filter by migration file regex
.filter(
move |entry| match entry.file_name().and_then(OsStr::to_str) {
.filter(move |entry| {
if entry.is_dir() {
return false;
}

match entry.file_name().and_then(OsStr::to_str) {
Some(file_name) if re.is_match(file_name) => true,
Some(file_name) => {
log::warn!(
Expand All @@ -98,8 +102,8 @@ pub fn find_migration_files(
false
}
None => false,
},
);
}
});

Ok(file_paths)
}
Expand Down Expand Up @@ -193,6 +197,28 @@ mod tests {
assert_eq!(sql2.canonicalize().unwrap(), mods[1]);
}

#[test]
fn finds_sql_migrations_in_nested_directories() {
let tmp_dir = TempDir::new().unwrap();
let migrations_dir = tmp_dir.path().join("migrations");
let nested_dir = migrations_dir.join("foo");
fs::create_dir(&migrations_dir).unwrap();
fs::create_dir(&nested_dir).unwrap();

let sql1 = nested_dir.join("V1__first.sql");
let sql2 = nested_dir.join("V2__second.sql");
fs::File::create(&sql1).unwrap();
fs::File::create(&sql2).unwrap();

let mut mods: Vec<PathBuf> = find_migration_files(migrations_dir, MigrationType::All)
.unwrap()
.collect();
mods.sort();

assert_eq!(sql1.canonicalize().unwrap(), mods[0]);
assert_eq!(sql2.canonicalize().unwrap(), mods[1]);
}

#[test]
fn finds_unversioned_migrations() {
let tmp_dir = TempDir::new().unwrap();
Expand Down
Loading