Skip to main content

mark_applied

Function mark_applied 

Source
pub async fn mark_applied(
    conn: &impl DbConnection,
    migrations_dir: &str,
    names: &[&str],
    dialect: Dialect,
) -> Result<u32, MigrateError>
Expand description

Records names as already applied without executing their SQL.

For adopting toolu-orm on a database whose schema was established by a prior migration system. Hashes come from _journal.json, so a later run_migrate still detects a tampered file. Names already recorded are skipped, so a repeated baseline is a no-op; the count is the number of rows newly recorded.

The migration files themselves are never read: the journal is the integrity record, and an adopting project may no longer have every historical .sql on disk.

§Errors

Returns MigrateError::NotInJournal when any name has no journal entry — nothing is recorded in that case — MigrateError::ReadFile when the journal cannot be read, or MigrateError::Database on a database failure.