plan method

SchemaPlan plan(
  1. MigrationDirection direction, {
  2. SchemaSnapshot? snapshot,
  3. String? defaultSchema,
  4. String? tablePrefix,
})

Builds a plan for the requested direction.

Implementation

SchemaPlan plan(
  MigrationDirection direction, {
  SchemaSnapshot? snapshot,
  String? defaultSchema,
  String? tablePrefix,
}) {
  final builder = SchemaBuilder(
    snapshot: snapshot,
    defaultSchema: defaultSchema,
    tablePrefix: tablePrefix,
  );
  switch (direction) {
    case MigrationDirection.up:
      up(builder);
      break;
    case MigrationDirection.down:
      down(builder);
      break;
  }

  final description = '${direction.name}:${runtimeType.toString()}';
  return builder.build(description: description);
}