SqlMigration constructor

SqlMigration(
  1. String sql, {
  2. String? reverseSql,
  3. MigrationErrorStrategy? errorStrategy,
  4. MigrationErrorStrategy? reverseErrorStrategy,
})

Construct a migration that will execute sql during upgrade (and reverseSql during downgrade, if provided).

Implementation

SqlMigration(
  String sql, {
  String? reverseSql,
  MigrationErrorStrategy? errorStrategy,
  MigrationErrorStrategy? reverseErrorStrategy,
}) : super(
          Operation<void>((db) async => db.execute(sql),
              errorStrategy: errorStrategy ?? MigrationErrorStrategy.Throw),
          reverse: Operation<void>(
              reverseSql != null
                  ? (db) async => db.execute(reverseSql)
                  : noop,
              errorStrategy: reverseErrorStrategy ??
                  errorStrategy ??
                  MigrationErrorStrategy.Throw));