Skip to content

Commit

Permalink
Simplify the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
i350 committed Sep 18, 2023
1 parent 4608884 commit 52eac63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Database/Console/Migrations/TableGuesser.php
Expand Up @@ -10,8 +10,8 @@ class TableGuesser
];

const CHANGE_PATTERNS = [
'/_(to|from|in)_(?!.*?(\_to\_|\_in\_|\_from\_))(\w+)_table$/',
'/_(to|from|in)_(?!.*?(\_to\_|\_in\_|\_from\_))(\w+)$/',
'/.+_(to|from|in)_(\w+)_table$/',
'/.+_(to|from|in)_(\w+)$/',
];

/**
Expand All @@ -30,7 +30,7 @@ public static function guess($migration)

foreach (self::CHANGE_PATTERNS as $pattern) {
if (preg_match($pattern, $migration, $matches)) {
return [$matches[3], $create = false];
return [$matches[2], $create = false];
}
}
}
Expand Down

0 comments on commit 52eac63

Please sign in to comment.