pub struct MigrationGraph {
pub all: Vec<Migration>,
pub order: Vec<String>,
pub replaced_by: HashMap<String, String>,
}Expand description
Graph of visible (non-replaced) migrations, in topological order.
Fields§
§all: Vec<Migration>All loaded migrations, including those replaced by a squash.
order: Vec<String>Ids in topological order (replaced ids omitted).
replaced_by: HashMap<String, String>replaced_id → squash_id.
Implementations§
Source§impl MigrationGraph
impl MigrationGraph
Sourcepub fn build(migrations: Vec<Migration>) -> Result<Self, MigrationError>
pub fn build(migrations: Vec<Migration>) -> Result<Self, MigrationError>
Validate dependencies, reject cycles and multiple heads, hide ids
listed in any loaded migration’s replaces.
§Errors
MigrationError::MissingDependency, MigrationError::Cycle,
MigrationError::MultipleHeads.
Sourcepub fn visible(&self) -> impl Iterator<Item = &Migration>
pub fn visible(&self) -> impl Iterator<Item = &Migration>
Visible migrations in topological order.
Sourcepub fn project_state(&self) -> Result<ProjectState, MigrationError>
pub fn project_state(&self) -> Result<ProjectState, MigrationError>
Replay visible migrations into a ProjectState.
§Errors
MigrationError::State if an operation does not apply.
Trait Implementations§
Source§impl Clone for MigrationGraph
impl Clone for MigrationGraph
Source§fn clone(&self) -> MigrationGraph
fn clone(&self) -> MigrationGraph
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MigrationGraph
impl RefUnwindSafe for MigrationGraph
impl Send for MigrationGraph
impl Sync for MigrationGraph
impl Unpin for MigrationGraph
impl UnsafeUnpin for MigrationGraph
impl UnwindSafe for MigrationGraph
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