Merge pull request #96 from BenVercammen/mariadbrunner-fix

MariaDbMigrationRunner assumed "batch" column to be string, but was int
This commit is contained in:
Thomas Hii 2023-03-22 07:51:24 +08:00 committed by GitHub
commit fcadbd4ccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,11 @@ class MariaDbMigrationRunner implements MigrationRunner {
var curBatch = 0; var curBatch = 0;
if (result.isNotEmpty) { if (result.isNotEmpty) {
var firstRow = result.toList(); 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; var batch = curBatch + 1;
@ -105,7 +109,11 @@ class MariaDbMigrationRunner implements MigrationRunner {
var curBatch = 0; var curBatch = 0;
if (result.isNotEmpty) { if (result.isNotEmpty) {
var firstRow = result.toList(); 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 result = await connection