runMigrations static method
Runs the given migrations for migrating the database schema and data.
Implementation
static Future<void> runMigrations(
final Database migrationDatabase,
final int startVersion,
final int endVersion,
final List<Migration> migrations,
) async {
final migrationPath =
_findMigrationPath(startVersion, endVersion, migrations);
if (migrationPath == null) {
throw StateError(
'There is no migration supplied to update the database to the current version.'
' Aborting the migration.',
);
}
for (final migration in migrationPath) {
await migration.migrate(migrationDatabase);
}
}