pub struct DatabaseSeederRunner { /* private fields */ }Expand description
Runs registered seeders in order inside a single transaction.
Ensures the __database_seeders table exists before querying it.
Implementations§
Source§impl DatabaseSeederRunner
impl DatabaseSeederRunner
Sourcepub fn add<S: DatabaseSeeder + 'static>(self, seeder: S) -> Self
pub fn add<S: DatabaseSeeder + 'static>(self, seeder: S) -> Self
Registers a seeder and returns the runner for chaining.
Sourcepub fn add_boxed(&mut self, seeder: Box<dyn DatabaseSeeder>)
pub fn add_boxed(&mut self, seeder: Box<dyn DatabaseSeeder>)
Registers an already-boxed seeder.
Sourcepub async fn seed(&self, db: &DatabaseConnection) -> Result<()>
pub async fn seed(&self, db: &DatabaseConnection) -> Result<()>
Runs all seeders in ascending order inside one transaction, recording each name.
Already-recorded seeders are skipped. Does nothing when no seeders are registered.
Sourcepub async fn delete(&self, db: &DatabaseConnection) -> Result<()>
pub async fn delete(&self, db: &DatabaseConnection) -> Result<()>
Deletes seeded data in descending order inside one transaction, removing each tracking row.
Seeders without a tracking row are skipped. Does nothing when no seeders are registered.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseSeederRunner
impl !UnwindSafe for DatabaseSeederRunner
impl Freeze for DatabaseSeederRunner
impl Send for DatabaseSeederRunner
impl Sync for DatabaseSeederRunner
impl Unpin for DatabaseSeederRunner
impl UnsafeUnpin for DatabaseSeederRunner
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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: 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