Migration.steps constructor

Migration.steps(
  1. String id,
  2. List<MigrationStep> steps, {
  3. required SqlDialect dialect,
  4. SchemaSnapshot? snapshot,
  5. String? previous,
})

Builds a plan with explicit operations and freezes its engine-specific schema.

Implementation

Migration.steps(
  this.id,
  List<MigrationStep> steps, {
  required this.dialect,
  SchemaSnapshot? snapshot,
  this.previous,
}) : steps = List.unmodifiable(steps.map((s) => _targetStep(s, dialect))),
     snapshot = snapshot?.forDialect(dialect) {
  if (!RegExp(r'^[0-9]+_[a-z][a-z0-9_]*$').hasMatch(id)) {
    throw ArgumentError(
      'Migration IDs use a numeric prefix and lowercase name.',
    );
  }
}