pub struct Migration {
pub from: (&'static str, Semver),
pub to: (&'static str, Semver),
pub rewrite: fn(&mut AttrMap) -> Result<(), MigrationError>,
}Expand description
One-step migration from (op_id, from) to (op_id, to).
Dialect crates register migrations via:
use vyre_driver::registry::{AttrMap, Migration, MigrationError, Semver};
fn rename_mode(attrs: &mut AttrMap) -> Result<(), MigrationError> {
attrs.rename("mode", "overflow_behavior");
Ok(())
}
inventory::submit! {
Migration::new(
("math.add", Semver::new(1, 0, 0)),
("math.add", Semver::new(2, 0, 0)),
rename_mode,
)
}Multiple migrations form a chain. MigrationRegistry::apply_chain
follows the chain to completion.
Fields§
§from: (&'static str, Semver)(op_id, from_version) - the shape on the wire.
to: (&'static str, Semver)(op_id, to_version) - the shape after rewrite.
rewrite: fn(&mut AttrMap) -> Result<(), MigrationError>The attribute-map rewrite function.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Migration
impl RefUnwindSafe for Migration
impl Send for Migration
impl Sync for Migration
impl Unpin for Migration
impl UnsafeUnpin for Migration
impl UnwindSafe for Migration
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