pub struct Background {
pub name: &'static str,
pub statements: &'static [&'static str],
}Expand description
A migration of statements that cannot run in a transaction, such as
CREATE INDEX CONCURRENTLY, which sqlx’s migrator runs each file in. Name each one
once and never change it: its name is what marks it done.
A statement that fails partway can leave something behind, as a failed
CREATE INDEX CONCURRENTLY leaves an invalid index, so begin with what clears it:
use axa_postgres_sqlx::Background;
const NOTES_BY_ITEM: Background = Background {
name: "2026_11_notes_by_item",
statements: &[
"DROP INDEX CONCURRENTLY IF EXISTS notes_by_item",
"CREATE INDEX CONCURRENTLY notes_by_item ON notes (item_id)",
],
};Fields§
§name: &'static strIts name, 1 to 200 characters with no control characters, recorded once it has run.
statements: &'static [&'static str]Its statements, each run alone, outside any transaction, in order.
Trait Implementations§
Source§impl Clone for Background
impl Clone for Background
impl Copy for Background
Source§impl Debug for Background
impl Debug for Background
impl Eq for Background
Source§impl PartialEq for Background
impl PartialEq for Background
impl StructuralPartialEq for Background
Auto Trait Implementations§
impl Forget for Background
impl Freeze for Background
impl Move for Background
impl RefUnwindSafe for Background
impl Send for Background
impl Sync for Background
impl Unpin for Background
impl UnsafeUnpin for Background
impl UnwindSafe for Background
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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