Skip to main content

init_schema_with_migrations

Function init_schema_with_migrations 

Source
pub fn init_schema_with_migrations(
    path: &Path,
    schema_ddl: &str,
    expected_version: u32,
    migrate: Option<MigrationFn>,
) -> Result<Connection>
Expand description

Initialize a SQLite database with optional incremental migration support.

Like init_schema, but when the current version is behind expected_version, calls the migrate callback instead of replaying the full DDL. Falls back to full DDL when migrate is None or the DB is fresh (version 0).