pub struct MigrationTracker { /* private fields */ }Expand description
Tracks applied migrations using a simple JSON file.
In a production implementation, this would be stored in the database itself as a projection. For now, we use a file-based tracker for simplicity.
Implementations§
Source§impl MigrationTracker
impl MigrationTracker
Sourcepub fn record_applied(
&self,
id: u32,
name: String,
checksum: String,
) -> Result<AppliedMigration>
pub fn record_applied( &self, id: u32, name: String, checksum: String, ) -> Result<AppliedMigration>
Records a migration as applied.
Sourcepub fn list_applied(&self) -> Result<Vec<AppliedMigration>>
pub fn list_applied(&self) -> Result<Vec<AppliedMigration>>
Lists all applied migrations.
Sourcepub fn is_applied(&self, id: u32) -> Result<bool>
pub fn is_applied(&self, id: u32) -> Result<bool>
Checks if a migration has been applied.
Sourcepub fn remove_applied(&self, id: u32) -> Result<()>
pub fn remove_applied(&self, id: u32) -> Result<()>
Removes a migration record (for rollback).
Sourcepub fn last_applied_id(&self) -> Result<Option<u32>>
pub fn last_applied_id(&self) -> Result<Option<u32>>
Gets the last applied migration ID.
Auto Trait Implementations§
impl Freeze for MigrationTracker
impl RefUnwindSafe for MigrationTracker
impl Send for MigrationTracker
impl Sync for MigrationTracker
impl Unpin for MigrationTracker
impl UnsafeUnpin for MigrationTracker
impl UnwindSafe for MigrationTracker
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