Skip to content

Commit e655969

Browse files
committed
fix: getMigrationName() logic
1 parent 7e73bab commit e655969

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

system/Database/MigrationRunner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MigrationRunner
6767
*
6868
* @var string
6969
*/
70-
protected $regex = '/^\d{4}[_-]?\d{2}[_-]?\d{2}[_-]?\d{6}_(\w+)$/';
70+
protected $regex = '/\A(\d{4}[_-]?\d{2}[_-]?\d{2}[_-]?\d{6})_(\w+)\z/';
7171

7272
/**
7373
* The main database connection. Used to store
@@ -547,9 +547,9 @@ protected function getMigrationNumber(string $migration): string
547547
*/
548548
protected function getMigrationName(string $migration): string
549549
{
550-
$parts = explode('_', $migration);
550+
preg_match($this->regex, $migration, $matches);
551551

552-
return array_pop($parts);
552+
return count($matches) ? $matches[2] : '';
553553
}
554554

555555
/**

0 commit comments

Comments
 (0)