Schema.fromMigrations constructor

Schema.fromMigrations(
  1. Set<Migration> migrations, [
  2. int? version
])

Create a schema from a set of migrations. If version is not provided, the highest migration version will be used

Implementation

factory Schema.fromMigrations(Set<Migration> migrations, [int? version]) {
  assert((version == null) || (version > -1));
  version = version ?? MigrationManager.latestMigrationVersion(migrations);
  final commands = expandMigrations(migrations);
  final tables = commands.fold(<SchemaTable>{}, _commandToSchema);

  return Schema(
    version,
    tables: tables,
  );
}