pub struct Migrator<E, S>{ /* private fields */ }Expand description
Helper for initializing and migrating the PgEventStore database schema.
Migrator encapsulates the logic required to:
- initialize the database for a fresh deployment
- apply schema migrations when upgrading between versions
It is intended to be used during application startup or in dedicated maintenance / administration workflows.
Implementations§
Source§impl<E, S> Migrator<E, S>
impl<E, S> Migrator<E, S>
pub fn new(event_store: PgEventStore<E, S>) -> Self
Sourcepub async fn init_event_store(&self) -> Result<(), Error>
pub async fn init_event_store(&self) -> Result<(), Error>
Init PgEventStore database
Sourcepub async fn init_listener(&self) -> Result<(), Error>
pub async fn init_listener(&self) -> Result<(), Error>
Init PgEventListener database
Sourcepub async fn migrate_v2_1_0_to_v3_0_0(&self) -> Result<(), Error>
pub async fn migrate_v2_1_0_to_v3_0_0(&self) -> Result<(), Error>
Migrate the database from version 2.1.0 to version 3.0.0
Backward compatible migration replacing HASH indexes with BTREE indexes
to improve performance.
Auto Trait Implementations§
impl<E, S> Freeze for Migrator<E, S>where
S: Freeze,
impl<E, S> !RefUnwindSafe for Migrator<E, S>
impl<E, S> Send for Migrator<E, S>where
E: Send,
impl<E, S> Sync for Migrator<E, S>where
E: Sync,
impl<E, S> Unpin for Migrator<E, S>
impl<E, S> !UnwindSafe for Migrator<E, S>
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: 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