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
impl MigrationConfig
Sourcepub fn with_table_name(self, name: impl Into<String>) -> Self
pub fn with_table_name(self, name: impl Into<String>) -> Self
Set the table name for migrations
Sourcepub fn with_transactions(self, enabled: bool) -> Self
pub fn with_transactions(self, enabled: bool) -> Self
Enable or disable transactions per migration
Sourcepub fn with_lock_timeout(self, timeout: Duration) -> Self
pub fn with_lock_timeout(self, timeout: Duration) -> Self
Set the lock timeout
Sourcepub fn without_lock_timeout(self) -> Self
pub fn without_lock_timeout(self) -> Self
Disable lock timeout
Sourcepub fn with_checksum_verification(self, enabled: bool) -> Self
pub fn with_checksum_verification(self, enabled: bool) -> Self
Enable or disable checksum verification
Sourcepub fn allow_out_of_order(self, enabled: bool) -> Self
pub fn allow_out_of_order(self, enabled: bool) -> Self
Allow out-of-order migrations
Sourcepub fn with_auto_create_table(self, enabled: bool) -> Self
pub fn with_auto_create_table(self, enabled: bool) -> Self
Set whether to auto-create the migrations table
Sourcepub fn with_max_retries(self, retries: u32) -> Self
pub fn with_max_retries(self, retries: u32) -> Self
Set maximum retries for transient errors
Sourcepub fn with_retry_delay(self, delay: Duration) -> Self
pub fn with_retry_delay(self, delay: Duration) -> Self
Set delay between retries
Sourcepub fn stop_on_error(self, enabled: bool) -> Self
pub fn stop_on_error(self, enabled: bool) -> Self
Set whether to stop on error
Sourcepub fn with_create_table_sql(self, sql: impl Into<String>) -> Self
pub fn with_create_table_sql(self, sql: impl Into<String>) -> Self
Set custom create table SQL
Sourcepub fn postgres_create_table_sql(&self) -> String
pub fn postgres_create_table_sql(&self) -> String
Get the SQL for creating the migrations table for PostgreSQL
Sourcepub fn sqlite_create_table_sql(&self) -> String
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
impl Clone for MigrationConfig
Source§fn clone(&self) -> MigrationConfig
fn clone(&self) -> MigrationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more