execute method

Future<int> execute()

Implementation

Future<int> execute() async
{
  final executor = MigrationExecutor(
    env: env,
    password: password,
    migrationsPath: migrationsPath,
    allowRollback: allowRollback,
  );
  try {
    await executor.migrate(
      targetIdentity: migrationIdentity,
      handler: handler,
    );
    return resultOk;
  } on AbortedException {
    return resultError;
  } on ConnectionException catch (e) {
    console?.errorLn('Failed to connect: ${e.message}.');
    return resultError;
  } on MigrationException catch (e) {
    console?.errorCLn('Failed to migrate the database: ${e.message}.');
    return resultError;
  } catch (e) {
    console?.errorCLn('Failed to migrate the database: $e.');
    return resultError;
  }
}