pub struct PostgresMigrator;Expand description
Applies the immutable OxideBatch PostgreSQL migration set.
Implementations§
Source§impl PostgresMigrator
impl PostgresMigrator
Sourcepub const fn supported_schema_version() -> u32
pub const fn supported_schema_version() -> u32
Returns the schema version installed by this crate.
Sourcepub async fn installed_schema_version(
config: &PostgresConfig,
) -> Result<Option<u32>, RepositoryError>
pub async fn installed_schema_version( config: &PostgresConfig, ) -> Result<Option<u32>, RepositoryError>
Reads the installed schema version without changing it.
This is the read-only counterpart of PostgresMigrator::migrate. It
takes no advisory lock, applies no migration, and creates no schema, so
an unprivileged operator identity can report migration state. An
uninitialized schema is reported as None rather than as a failure,
because “not yet migrated” is an answer rather than an outage.
§Errors
Returns a redacted configuration or repository failure. The connection string, driver message, and SQL text are never included.
Sourcepub async fn migrate(config: &PostgresConfig) -> Result<(), RepositoryError>
pub async fn migrate(config: &PostgresConfig) -> Result<(), RepositoryError>
Applies pending migrations under a database-scoped advisory lock.
This operation is intended for a dedicated migrator identity. Runtime repository startup only verifies the schema and never migrates it.
§Errors
Returns a redacted configuration or repository failure. A newer schema is never changed.
Trait Implementations§
Source§impl Clone for PostgresMigrator
impl Clone for PostgresMigrator
Source§fn clone(&self) -> PostgresMigrator
fn clone(&self) -> PostgresMigrator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PostgresMigrator
Source§impl Debug for PostgresMigrator
impl Debug for PostgresMigrator
Source§impl Default for PostgresMigrator
impl Default for PostgresMigrator
Source§fn default() -> PostgresMigrator
fn default() -> PostgresMigrator
Auto Trait Implementations§
impl Freeze for PostgresMigrator
impl RefUnwindSafe for PostgresMigrator
impl Send for PostgresMigrator
impl Sync for PostgresMigrator
impl Unpin for PostgresMigrator
impl UnsafeUnpin for PostgresMigrator
impl UnwindSafe for PostgresMigrator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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