SqlMigration constructor
SqlMigration(
- String sql, {
- String? reverseSql,
- MigrationErrorStrategy? errorStrategy,
- 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));