diff --git a/CHANGELOG.md b/CHANGELOG.md index e54f641..2245888 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Release Notes for 0.1.x +## [v0.2.1 (2023-09-30)](https://github.com/barbosa89/phenix/compare/0.2.1...0.2.0) + +### Fixed +- Ensure dabatase directory exists before create migration. ([49](https://github.com/barbosa89/phenix/pull/49)) + ## [v0.2.0 (2023-09-29)](https://github.com/barbosa89/phenix/compare/0.2.0...0.1.0) ### Added diff --git a/core/Database/Console/MakeMigration.php b/core/Database/Console/MakeMigration.php index 4f6fbf8..5d62afd 100644 --- a/core/Database/Console/MakeMigration.php +++ b/core/Database/Console/MakeMigration.php @@ -6,6 +6,7 @@ use Carbon\Carbon; use Core\Console\Maker; +use Core\Facades\File; use Core\Util\Str; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -42,6 +43,10 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { + if (! File::exists(base_path('database'))) { + File::createDirectory(base_path('database')); + } + $datetime = Carbon::now()->format('YmdHis'); $this->fileName = $datetime . '_' . Str::snake($input->getArgument('name'));