pub struct Registry { /* private fields */ }Expand description
Registry of migrations, ordered by to_version then registration order.
Implementations§
Source§impl Registry
impl Registry
pub fn empty() -> Self
pub fn register(&mut self, m: Box<dyn Migration>)
Sourcepub fn plan<'a>(
&'a self,
current: &Version,
target: &Version,
) -> Vec<&'a dyn Migration>
pub fn plan<'a>( &'a self, current: &Version, target: &Version, ) -> Vec<&'a dyn Migration>
Migrations whose to_version is > current and <= target and
whose from_version requirement matches current.
Sourcepub fn run(
&self,
repo: &Repository,
ref_name: &str,
target: &Version,
mode: RunMode,
) -> Result<Report, MigrateError>
pub fn run( &self, repo: &Repository, ref_name: &str, target: &Version, mode: RunMode, ) -> Result<Report, MigrateError>
Execute the plan.
Each migration runs as its own commit. On failure, earlier commits remain durable — operators re-run or branch from the last good commit.
pub fn iter(&self) -> impl Iterator<Item = &dyn Migration>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
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