From 0b6b48d5ecea7093a227f85fdf36d9b6ab5d1aee Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 19 Oct 2022 14:49:48 +0200 Subject: [PATCH] Cleanup up the restore command and sort the input files --- src/Console/RestoreDatabaseCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Console/RestoreDatabaseCommand.php b/src/Console/RestoreDatabaseCommand.php index 12397a6..7c3c1ec 100644 --- a/src/Console/RestoreDatabaseCommand.php +++ b/src/Console/RestoreDatabaseCommand.php @@ -40,10 +40,11 @@ class RestoreDatabaseCommand extends Command if (!$fileName){ $finder = new Finder(); $finder->in(__DIR__ . '/../..'); - $files = [sprintf('%s_backup.sql', $db)]; + $files = []; foreach ($finder->files()->name('*_backup.sql') as $file) { $files[] = $file->getFilename(); } + sort($files); $selectQuestion = new ChoiceQuestion('Backup name (*_backup.sql): ', $files); $fileName = $question->ask($input, $output, $selectQuestion); }