Migration class abstract

One reversible schema change. Subclass it, implement up and down, and hand instances to a Migrator in the order they should run.

class CreateUsersTable extends Migration {
  @override
  Future<void> up(SchemaBuilder schema) => schema.create('users', (t) {
    t.id();
    t.string('email').unique();
    t.timestamps();
  });

  @override
  Future<void> down(SchemaBuilder schema) => schema.dropIfExists('users');
}

Constructors

Migration()

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
Recorded in the migrations table; must be unique. Defaults to the class name.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

down(SchemaBuilder schema) Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
up(SchemaBuilder schema) Future<void>

Operators

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