pub struct Migration {
pub id: String,
pub description: String,
pub up: String,
pub down: String,
}Expand description
A database migration.
Fields§
§id: StringUnique migration ID (typically timestamp-based)
description: StringHuman-readable description
up: StringSQL to apply the migration
down: StringSQL to revert the migration
Implementations§
Source§impl Migration
impl Migration
Sourcepub fn new(
id: impl Into<String>,
description: impl Into<String>,
up: impl Into<String>,
down: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, description: impl Into<String>, up: impl Into<String>, down: impl Into<String>, ) -> Self
Create a new migration.
Sourcepub fn new_version() -> String
pub fn new_version() -> String
Generate a new migration version from the current timestamp.
Format: YYYYMMDDHHMMSS
Sourcepub fn from_operations(
ops: &[SchemaOperation],
ddl: &dyn DdlGenerator,
description: impl Into<String>,
) -> Self
pub fn from_operations( ops: &[SchemaOperation], ddl: &dyn DdlGenerator, description: impl Into<String>, ) -> Self
Create a migration from schema operations.
Uses the provided DDL generator to create UP (forward) and DOWN (rollback) SQL.
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).