expandAllMigrations method

Iterable<Migration> expandAllMigrations(
  1. LibraryReader library
)

Search library for all classes that extend Migration. Recreate these in Dart Code

Implementation

Iterable<Migration> expandAllMigrations(LibraryReader library) {
  final classes = library.annotatedWith(_migrationAnnotationChecker);

  return classes.map((migration) {
    final reader = migration.annotation;
    return _MigrationImpl(
      version: int.parse(reader.read('version').stringValue),
      up: _migrationCommandsFromReader(reader.read('up').listValue),
      down: _migrationCommandsFromReader(reader.read('down').listValue),
    );
  });
}