MigrationTransaction class

A transactional execution context. Returned by a MigrationTransactionFactory when the user opts in to automatic transaction wrapping.

The user-provided factory creates one of these per up / down invocation; the runner calls MigrationTransaction.commit on success and MigrationTransaction.rollback on exception.

Constructors

MigrationTransaction({required MigrationExecutor executor, required void commit(), required void rollback()})
Creates a transaction. The executor is the callback the migration body uses to run SQL. The commit / rollback actions are invoked by the runner exactly once per transaction.
const

Properties

commit → void Function()
Commits the transaction. Idempotent — calling it more than once is a no-op (in case the user wraps their own callback logic around the runner).
final
executor MigrationExecutor
The executor the migration body uses to run SQL statements. Bound to the in-flight transaction.
final
hashCode int
The hash code for this object.
no setterinherited
rollback → void Function()
Rolls back the transaction. Idempotent.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited