MigrationConfig

Struct MigrationConfig 

Source
pub struct MigrationConfig {
    pub table: TableConfig,
    pub transaction_per_migration: bool,
    pub lock_timeout: Option<Duration>,
    pub verify_checksums: bool,
    pub allow_out_of_order: bool,
    pub auto_create_table: bool,
    pub max_retries: u32,
    pub retry_delay: Duration,
    pub stop_on_error: bool,
    pub create_table_sql: Option<String>,
}
Expand description

Configuration for the migration runner

Fields§

§table: TableConfig

Table configuration

§transaction_per_migration: bool

Whether to run each migration in a transaction

§lock_timeout: Option<Duration>

Lock timeout for acquiring exclusive migration lock

§verify_checksums: bool

Whether to verify checksums of applied migrations

§allow_out_of_order: bool

Whether to allow out-of-order migrations

§auto_create_table: bool

Whether to create the migrations table if it doesn’t exist

§max_retries: u32

Maximum number of retries for transient errors

§retry_delay: Duration

Delay between retries

§stop_on_error: bool

Whether to continue on error or stop

§create_table_sql: Option<String>

Custom SQL for creating the migrations table (database-specific)

Implementations§

Source§

impl MigrationConfig

Source

pub fn new() -> Self

Create a new configuration with default values

Source

pub fn with_table_name(self, name: impl Into<String>) -> Self

Set the table name for migrations

Source

pub fn with_transactions(self, enabled: bool) -> Self

Enable or disable transactions per migration

Source

pub fn with_lock_timeout(self, timeout: Duration) -> Self

Set the lock timeout

Source

pub fn without_lock_timeout(self) -> Self

Disable lock timeout

Source

pub fn with_checksum_verification(self, enabled: bool) -> Self

Enable or disable checksum verification

Source

pub fn allow_out_of_order(self, enabled: bool) -> Self

Allow out-of-order migrations

Source

pub fn with_auto_create_table(self, enabled: bool) -> Self

Set whether to auto-create the migrations table

Source

pub fn with_max_retries(self, retries: u32) -> Self

Set maximum retries for transient errors

Source

pub fn with_retry_delay(self, delay: Duration) -> Self

Set delay between retries

Source

pub fn stop_on_error(self, enabled: bool) -> Self

Set whether to stop on error

Source

pub fn with_create_table_sql(self, sql: impl Into<String>) -> Self

Set custom create table SQL

Source

pub fn postgres_create_table_sql(&self) -> String

Get the SQL for creating the migrations table for PostgreSQL

Source

pub fn sqlite_create_table_sql(&self) -> String

Get the SQL for creating the migrations table for SQLite

Trait Implementations§

Source§

impl Clone for MigrationConfig

Source§

fn clone(&self) -> MigrationConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MigrationConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MigrationConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.