pub struct Migrator { /* private fields */ }Expand description
Structural Fingerprinting Engine entry point.
Compares Rust Abstract Syntax Tree snapshots loaded from .json
iteratively against information_schema.columns.
Implementations§
Source§impl Migrator
impl Migrator
Sourcepub fn new(pool: AnyPool) -> Self
pub fn new(pool: AnyPool) -> Self
Initializes a new Migrator against the provided sqlx Database Pool.
Sourcepub async fn migrate_table(
&self,
table_name: &str,
history: &[SnapshotModel],
) -> Result<(), String>
pub async fn migrate_table( &self, table_name: &str, history: &[SnapshotModel], ) -> Result<(), String>
Migrate a single table using the Structural Fingerprinting Engine.
Sourcepub async fn rollback_table(
&self,
table_name: &str,
history: &[SnapshotModel],
) -> Result<(), String>
pub async fn rollback_table( &self, table_name: &str, history: &[SnapshotModel], ) -> Result<(), String>
Rollback a single table by one exact structural fingerprint.
Sourcepub fn diff_snapshots(
&self,
a: Option<&SnapshotModel>,
b: &SnapshotModel,
) -> Vec<String>
pub fn diff_snapshots( &self, a: Option<&SnapshotModel>, b: &SnapshotModel, ) -> Vec<String>
Analytically computes exact directional ALTER TABLE / CREATE TABLE translations
between two structural states using the AST Snapshot models.
Sourcepub fn map_type_to_pg(&self, ti: &str) -> String
pub fn map_type_to_pg(&self, ti: &str) -> String
Fallbacks Rust AST macro-string definitions securely into Native PostgreSQL string syntaxes.
Auto Trait Implementations§
impl !RefUnwindSafe for Migrator
impl !UnwindSafe for Migrator
impl Freeze for Migrator
impl Send for Migrator
impl Sync for Migrator
impl Unpin for Migrator
impl UnsafeUnpin for Migrator
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
impl<T> FlozRowBound for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more