pub struct MigrationRunner { /* private fields */ }Expand description
Migration runner for executing migrations.
Implementations§
Source§impl MigrationRunner
impl MigrationRunner
Sourcepub fn new(migrations: Vec<Migration>) -> Self
pub fn new(migrations: Vec<Migration>) -> Self
Create a new migration runner with the given migrations.
Sourcepub fn table_name(self, name: impl Into<String>) -> Self
pub fn table_name(self, name: impl Into<String>) -> Self
Set a custom migrations tracking table name.
The name is sanitized to only allow alphanumeric characters and underscores to prevent SQL injection.
Sourcepub async fn init<C: Connection>(&self, cx: &Cx, conn: &C) -> Outcome<(), Error>
pub async fn init<C: Connection>(&self, cx: &Cx, conn: &C) -> Outcome<(), Error>
Ensure the migrations tracking table exists.
Sourcepub async fn status<C: Connection>(
&self,
cx: &Cx,
conn: &C,
) -> Outcome<Vec<(String, MigrationStatus)>, Error>
pub async fn status<C: Connection>( &self, cx: &Cx, conn: &C, ) -> Outcome<Vec<(String, MigrationStatus)>, Error>
Get the status of all migrations.
Auto Trait Implementations§
impl Freeze for MigrationRunner
impl RefUnwindSafe for MigrationRunner
impl Send for MigrationRunner
impl Sync for MigrationRunner
impl Unpin for MigrationRunner
impl UnsafeUnpin for MigrationRunner
impl UnwindSafe for MigrationRunner
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).