pub struct MigrationManager<'a> { /* private fields */ }Expand description
Manages database schema migrations
Implementations§
Source§impl<'a> MigrationManager<'a>
impl<'a> MigrationManager<'a>
Sourcepub fn new(conn: &'a mut Connection) -> Self
pub fn new(conn: &'a mut Connection) -> Self
Create a new migration manager
Sourcepub fn initialize_database(&mut self) -> Result<()>
pub fn initialize_database(&mut self) -> Result<()>
Initialize database with current schema
Sourcepub fn create_connection(db_path: &Path) -> Result<Connection>
pub fn create_connection(db_path: &Path) -> Result<Connection>
Create database connection with migrations applied
Sourcepub fn cleanup_old_data(&mut self, older_than_days: i32) -> Result<usize>
pub fn cleanup_old_data(&mut self, older_than_days: i32) -> Result<usize>
Clean up old data - needs mutable access
Sourcepub fn get_current_version(&self) -> Result<i32>
pub fn get_current_version(&self) -> Result<i32>
Get current schema version
Sourcepub fn has_migration_applied(&self, version: i32) -> Result<bool>
pub fn has_migration_applied(&self, version: i32) -> Result<bool>
Check if a specific migration has been applied
Auto Trait Implementations§
impl<'a> Freeze for MigrationManager<'a>
impl<'a> !RefUnwindSafe for MigrationManager<'a>
impl<'a> Send for MigrationManager<'a>
impl<'a> !Sync for MigrationManager<'a>
impl<'a> Unpin for MigrationManager<'a>
impl<'a> UnsafeUnpin for MigrationManager<'a>
impl<'a> !UnwindSafe for MigrationManager<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more