Migrator class

Runs and rolls back Migrations, recording each in a repository table the way Laravel's migrations table does. Every migration runs inside its own transaction, so a failing up() leaves neither its tables nor its repository row behind. On MySQL, DDL statements commit implicitly, so a migration that fails halfway may leave tables behind; the repository row is still not written, so fixing and re-running is safe once you drop what was created. Laravel has the same limitation.

Constructors

Migrator(Connection connection, List<Migration> migrations, {String table = 'migrations', void log(String message)?})

Properties

connection Connection
final
grammar SchemaGrammar
final
hashCode int
The hash code for this object.
no setterinherited
log → void Function(String message)?
Receives one progress line per migration run or rolled back.
final
migrations List<Migration>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
table String
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() Future<List<String>>
reset then run. Returns the names that ran.
reset() Future<List<String>>
Rolls back every migration that has run.
rollback({int steps = 1}) Future<List<String>>
Rolls back the last steps batches, newest migration first.
run() Future<List<String>>
Runs every pending migration in order as one new batch. Returns the names that ran.
status() Future<List<MigrationStatus>>
toString() String
A string representation of this object.
inherited

Operators

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