pub struct Migration {
pub version: String,
pub up_sql: String,
pub transactional: bool,
}Expand description
A single migration with up SQL.
Fields§
§version: StringStable version identifier — for system migrations __forge_vNNN,
for user migrations the file stem like 0001_create_users.
up_sql: StringSQL to execute for upgrade.
transactional: boolWrap the migration in a transaction. Defaults to true.
Set to false for statements PostgreSQL refuses to run inside a tx
(CREATE INDEX CONCURRENTLY, ALTER TYPE ... ADD VALUE, VACUUM,
REINDEX CONCURRENTLY) via the -- @transactional false directive.
Implementations§
Source§impl Migration
impl Migration
Sourcepub fn parse(version: impl Into<String>, content: &str) -> Self
pub fn parse(version: impl Into<String>, content: &str) -> Self
Parse migration content.
Recognized directives in the leading comment block (first 20 lines):
-- @up(legacy marker, stripped if present)-- @transactional falseopts out of the wrapping transaction
The @ prefix is required so plain English comments
(-- transactional design ...) don’t accidentally trigger directives.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Migration
impl RefUnwindSafe for Migration
impl Send for Migration
impl Sync for Migration
impl Unpin for Migration
impl UnsafeUnpin for Migration
impl UnwindSafe for Migration
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<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