Std.Db.Migrate.apply
fn
apply: &Std.Db.Driver.Client -> &Std.Db.Driver.Driver -> &Array[Std.Db.Migrate.Migration] -> Result[Int, Std.Db.Migrate.MigrationError]This is a callable function.
What it does
Bring the schema to what the program expects, through any driver.
The plan is decided before any lock is taken, so a refusal holds nothing.
Each pending migration then runs in a transaction of its own, which on
PostgreSQL first takes a lock that ends with the transaction: it cannot be
left held by a failure, and a pooled connection goes back to the pool with
nothing attached to it. Inside the lock the record is read again, so a
process that waited for another finds its migration already there and
skips it rather than running it twice.
SQLite has one writer at a time already. A second process that reaches the
same file mid-migration is refused as busy rather than left waiting, and
running it again finds nothing to do.
Answers how many migrations this call applied.
Read the signature
- The text after the name is the type checked by Pudu.
- Read arrows from left to right: inputs come first, and the final type is returned.
- & borrows a value for this call instead of moving or copying it.
- Names inside [ ] are type arguments, such as the item type held by a collection.
- Result makes success and recoverable failure part of the function's type.
