Skip to content

Commit

Permalink
Make fn Migrations::max_schema_version public.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Helfet committed Jul 5, 2024
1 parent ce9ea7a commit 21dd0d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rusqlite_migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ impl<'m> Migrations<'m> {
}

/// Maximum version defined in the migration set
fn max_schema_version(&self) -> SchemaVersion {
pub fn max_schema_version(&self) -> SchemaVersion {
match self.ms.len() {
0 => SchemaVersion::NoneSet,
v => SchemaVersion::Inside(
Expand Down
8 changes: 8 additions & 0 deletions rusqlite_migration/src/tests/synch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ fn user_version_migrate_test() {
Ok(SchemaVersion::Inside(NonZeroUsize::new(1).unwrap())),
migrations.current_version(&conn)
);
assert_eq!(
SchemaVersion::Inside(NonZeroUsize::new(1).unwrap()),
migrations.max_schema_version()
);

let migrations = Migrations::new(vec![m_valid10(), m_valid11()]);
assert_eq!(Ok(()), migrations.to_latest(&mut conn));
Expand All @@ -278,6 +282,10 @@ fn user_version_migrate_test() {
Ok(SchemaVersion::Inside(NonZeroUsize::new(2).unwrap())),
migrations.current_version(&conn)
);
assert_eq!(
SchemaVersion::Inside(NonZeroUsize::new(2).unwrap()),
migrations.max_schema_version()
);
}

#[test]
Expand Down

0 comments on commit 21dd0d4

Please sign in to comment.