pub struct Migrator<X> { /* private fields */ }Expand description
An ordered, idempotent set of migrations for one executor type X.
Implementations§
Source§impl<X: Executor> Migrator<X>
impl<X: Executor> Migrator<X>
pub fn new() -> Self
Sourcepub fn create_table<E: Entity + 'static>(self, name: &'static str) -> Self
pub fn create_table<E: Entity + 'static>(self, name: &'static str) -> Self
Append a “create E’s table” step.
Sourcepub fn names(&self) -> Vec<&'static str>
pub fn names(&self) -> Vec<&'static str>
The names of every step, in registration order — what a
migration-runner port reports as defined(), and the source of
the migration “head” used to dedupe boot-time runs.
The port that reports it is defined by the consumer, not here.
Sourcepub async fn run(&self, db: &X) -> Result<Vec<&'static str>>
pub async fn run(&self, db: &X) -> Result<Vec<&'static str>>
Apply every not-yet-applied step to db, recording each in
_orm_migrations. Idempotent: re-running applies only new steps.
Returns the names applied this run.
When db reports it is sharded (Executor::is_sharded),
the sharding control tables (shards, shard_directory) are ensured on
its global database first — the ORM owns that metadata, so no flavor
declares it. A no-op on a single, unsharded database.
Trait Implementations§
Auto Trait Implementations§
impl<X> !RefUnwindSafe for Migrator<X>
impl<X> !Send for Migrator<X>
impl<X> !Sync for Migrator<X>
impl<X> !UnwindSafe for Migrator<X>
impl<X> Freeze for Migrator<X>
impl<X> Unpin for Migrator<X>
impl<X> UnsafeUnpin for Migrator<X>
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