Pudu programming language
Menu

Std.Db.Migrate.migrate

1 declaration

fn

migrate: Std.Db.Session.Connection -> &Array[Std.Db.Migrate.Migration] -> Result[(Int, Std.Db.Session.Connection), Std.Db.Migrate.MigrationError]

This is a callable function.

What it does

Bring the schema to what the program expects, on one PostgreSQL session.

Each migration runs in its own transaction, so a failure leaves every

earlier one applied and the failing one absent and the record always

describes the schema. One transaction around all of them is attractive

until a statement that cannot run inside one appears.

The session lock is released on every path, refusals included, because a

connection that goes back to a pool still holding it stops every later

migration everywhere.

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.

Back to Std.Db.MigrateSearch related declarations