#[non_exhaustive]pub enum MigrateError {
InvalidSchema {
schema: String,
},
Sqlx {
source: MigrateError,
},
UnsupportedServerVersion {
required: u32,
detected: u32,
},
}Expand description
migrate’s failure. Provider-owned, not a re-export of sqlx::migrate::MigrateError:
a rejected schema identifier has no variant in sqlx’s own type to
report it as, since that check happens before any sqlx::migrate code runs at all.
use reliar_store_postgres::{MigrateOptions, migrate};
let options = MigrateOptions::default().schema("Not-Lowercase");
if let Err(err) = migrate(&pool, options).await {
eprintln!("migration failed: {err}");
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidSchema
options.schema is not a valid PostgreSQL identifier ([a-z_][a-z0-9_$]*, at most 63
bytes, lowercase only — PostgreSQL folds an unquoted identifier to lowercase, so an
uppercase name would migrate into a schema the rest of the crate, and the host’s own
search_path, can never consistently resolve; ADR 0040 §5). Checked before the name
reaches dangerous_set_table_name, which is string interpolation into DDL.
Sqlx
Any failure from sqlx::migrate::Migrator::run or the dedicated connection’s own setup
(a connection failure, a checksum mismatch against an already-applied file, …).
Fields
source: MigrateErrorThe underlying sqlx migration error.
UnsupportedServerVersion
The connected server’s server_version_num is below
crate::MIN_SERVER_VERSION_NUM (PostgreSQL 18, ADR 0041 / human decision #47) — no
older-version fallback. Checked as the first statement on migrate’s dedicated
connection, before SET search_path, schema creation, or any migration file runs — a
refused migrate() leaves the database exactly as it found it. migrate.rs declares its
own copy of this variant rather than re-exporting
crate::PostgresStoreError::UnsupportedServerVersion — the same shape as
Self::InvalidSchema alongside crate::PostgresStoreError::InvalidSchema.
Fields
required: u32crate::MIN_SERVER_VERSION_NUM, restated on the value.
Trait Implementations§
Source§impl Debug for MigrateError
impl Debug for MigrateError
Source§impl Display for MigrateError
impl Display for MigrateError
Source§impl Error for MigrateError
impl Error for MigrateError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for MigrateError
impl From<Error> for MigrateError
Source§impl From<MigrateError> for MigrateError
impl From<MigrateError> for MigrateError
Source§fn from(source: MigrateError) -> Self
fn from(source: MigrateError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for MigrateError
impl !UnwindSafe for MigrateError
impl Freeze for MigrateError
impl Send for MigrateError
impl Sync for MigrateError
impl Unpin for MigrateError
impl UnsafeUnpin for MigrateError
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> 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