pub struct Migration<T> {
pub from: fn() -> Version,
pub to: fn() -> Version,
pub up: fn(_: &Migration<T>, _: &mut T) -> Result<(), Box<dyn Error>>,
pub down: fn(_: &Migration<T>, _: &mut T) -> Result<(), Box<dyn Error>>,
}Fields§
§from: fn() -> Version§to: fn() -> Version§up: fn(_: &Migration<T>, _: &mut T) -> Result<(), Box<dyn Error>>§down: fn(_: &Migration<T>, _: &mut T) -> Result<(), Box<dyn Error>>Implementations§
source§impl<T> Migration<T>
impl<T> Migration<T>
pub fn from(&self) -> Version
pub fn to(&self) -> Version
pub fn change( &self, doc: &mut T, from: &Version, to: &Version, ) -> Result<ChangeResult, Box<dyn Error>>
pub fn migrate_from( from: &Version, to: &Version, doc: &mut T, migrations: &[Self], ) -> Result<bool, Box<dyn Error>>
sourcepub fn migrate(
version: &Version,
doc: &mut T,
migrations: &[Self],
) -> Result<bool, Box<dyn Error>>
pub fn migrate( version: &Version, doc: &mut T, migrations: &[Self], ) -> Result<bool, Box<dyn Error>>
Migrate the database schema to the current version. If the version is already the current version, nothing is done. If the version is older, the database is upgraded. If the version is newer, the database is downgraded. Returns true if the database was migrated, false if it was already at the current version.
Auto Trait Implementations§
impl<T> Freeze for Migration<T>
impl<T> RefUnwindSafe for Migration<T>
impl<T> Send for Migration<T>
impl<T> Sync for Migration<T>
impl<T> Unpin for Migration<T>
impl<T> UnwindSafe for Migration<T>
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