Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better missing/extra migration exception page #3005

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Code style
  • Loading branch information
tadhgboyle committed Aug 8, 2022
commit 2977522c6b5dd02acbd52b7bb29d92e279d2b919
17 changes: 10 additions & 7 deletions core/classes/Database/PhinxAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ class PhinxAdapter {
* @throws RuntimeException If these numbers don't match.
*/
public static function ensureUpToDate(): void {
$migration_files = array_map(static function ($file_name) {
[$version, $migration_name] = explode('_', $file_name, 2);
$migration_name = str_replace(['.php', '_'], '', ucwords($migration_name, '_'));
return $version . '_' . $migration_name;
}, array_filter(scandir(__DIR__ . '/../../migrations'), static function ($file_name) {
return !in_array($file_name, ['.', '..', 'phinx.php']);
}));
$migration_files = array_map(
static function ($file_name) {
[$version, $migration_name] = explode('_', $file_name, 2);
$migration_name = str_replace(['.php', '_'], '', ucwords($migration_name, '_'));
return $version . '_' . $migration_name;
},
array_filter(scandir(__DIR__ . '/../../migrations'), static function ($file_name) {
return !in_array($file_name, ['.', '..', 'phinx.php']);
}),
);

$migration_database_entries = array_map(static function ($row) {
return $row->version . '_' . $row->migration_name;
Expand Down