Migrator class final

Validates and executes a fixed history against one raw SQL runtime.

The caller owns database and closes it after migration work finishes. Applying or baselining acquires the engine's migration lock. A migrator never guesses a rename or silently accepts a changed applied migration.

Constructors

Migrator(SqlDatabase<Backend> database, {Duration lockTimeout = const Duration(seconds: 30)})
Uses an existing runtime; constructing a migrator performs no database I/O.
const

Properties

database SqlDatabase<Backend>
Runtime used for migration catalog reads and writes.
final
hashCode int
The hash code for this object.
no setterinherited
lockTimeout Duration
Maximum wait for the database's migration lock.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(List<Migration> migrations, {int? maxBackfillBatches}) Future<List<String>>
Applies pending migrations, returning the IDs completed by this call. SQLite/PostgreSQL batches of transactional steps are atomic. CheckedSql and Backfill opt their containing migration into durable per-step recovery. MySQL/MariaDB DDL uses checked, recoverable steps because the database can commit schema changes implicitly.
baseline(List<Migration> migrations, {required SchemaSnapshot expected}) Future<SchemaVerification>
Registers a verified existing database without replaying creation SQL.
history() Future<List<MigrationStatus>>
Returns completed migrations in identifier order.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
plan(List<Migration> migrations) Future<List<Migration>>
Validates the supplied history and returns its unapplied suffix.
progress() Future<List<MigrationProgress>>
Durable step checkpoints, including failed stages of partially applied migrations.
requireVersion(List<Migration> migrations, {String? minimum, String? maximum}) Future<MigrationStatus>
Checks startup compatibility in one read snapshot. Defaults to the latest bundled migration; an explicit inclusive range supports compatible releases. Does not apply migrations, verify catalog drift or lock out later upgrades.
toString() String
A string representation of this object.
inherited

Operators

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