MigrationFile class abstract

Contract representing a database migration file.

Implement this class to define schema changes for your database.

Example:

class CreateUsersTable extends MigrationFile {
  @override
  Future<void> up(SchemaBuilder builder) async {
    builder.create('users', (table) {
      table.id();
      table.string('name');
    });
  }

  @override
  Future<void> down(SchemaBuilder builder) async {
    builder.drop('users');
  }
}

Constructors

MigrationFile()

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
Optional name for this migration (usually class name).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

down(SchemaBuilder builder) Future<void>
Defines how to reverse the schema operations.
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 builder) Future<void>
Defines the schema operations to apply.

Operators

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