Skip to content

Commit d0e1088

Browse files
authored
Fix arithmetic
1 parent 841a000 commit d0e1088

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

system/Database/MigrationRunner.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ public function progress(string $group = null)
223223
throw new \RuntimeException($message);
224224
}
225225
}
226+
226227
return true;
227228
}
228229

@@ -260,7 +261,7 @@ public function regress(int $targetBatch, string $group = null)
260261
// Convert a relative batch to its absolute
261262
if ($targetBatch < 0)
262263
{
263-
$targetBatch = $batches[count($batches) + $targetBatch] ?? 0;
264+
$targetBatch = $batches[count($batches) - 1 + $targetBatch] ?? 0;
264265
}
265266

266267
// If the goal was rollback then check if it is done
@@ -341,6 +342,7 @@ public function regress(int $targetBatch, string $group = null)
341342
throw new \RuntimeException($message);
342343
}
343344
}
345+
344346
return true;
345347
}
346348

@@ -876,7 +878,7 @@ public function getBatchStart(int $batch): string
876878
if ($batch < 0)
877879
{
878880
$batches = $this->getBatches();
879-
$batch = $batches[count($batches) + $targetBatch] ?? 0;
881+
$batch = $batches[count($batches) - 1 + $targetBatch] ?? 0;
880882
}
881883

882884
$migration = $this->db->table($this->table)
@@ -905,7 +907,7 @@ public function getBatchEnd(int $batch): string
905907
if ($batch < 0)
906908
{
907909
$batches = $this->getBatches();
908-
$batch = $batches[count($batches) + $targetBatch] ?? 0;
910+
$batch = $batches[count($batches) - 1 + $targetBatch] ?? 0;
909911
}
910912

911913
$migration = $this->db->table($this->table)

0 commit comments

Comments
 (0)