From 0905afecbd4b5f5a992552eb91e268910773ccd1 Mon Sep 17 00:00:00 2001 From: Ben Vercammen Date: Tue, 7 Mar 2023 09:15:39 +0100 Subject: [PATCH] Fixed MariaDbMigrationRunner, which assumed "batch" column to be string instead of int --- .../lib/src/mariadb/runner.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/orm/angel_migration_runner/lib/src/mariadb/runner.dart b/packages/orm/angel_migration_runner/lib/src/mariadb/runner.dart index 1609a72f..24473657 100644 --- a/packages/orm/angel_migration_runner/lib/src/mariadb/runner.dart +++ b/packages/orm/angel_migration_runner/lib/src/mariadb/runner.dart @@ -71,7 +71,11 @@ class MariaDbMigrationRunner implements MigrationRunner { var curBatch = 0; if (result.isNotEmpty) { var firstRow = result.toList(); - curBatch = int.tryParse(firstRow[0][0] ?? '0') as int; + var firstBatch = firstRow[0][0] ?? 0; + if (firstBatch is! int) { + int.tryParse(firstBatch) as int; + } + curBatch = firstBatch; } var batch = curBatch + 1; @@ -105,7 +109,11 @@ class MariaDbMigrationRunner implements MigrationRunner { var curBatch = 0; if (result.isNotEmpty) { var firstRow = result.toList(); - curBatch = int.tryParse(firstRow[0][0]) as int; + var firstBatch = firstRow[0][0]; + if (firstBatch is! int) { + int.tryParse(firstBatch) as int; + } + curBatch = firstBatch; } result = await connection