Skip to content

Commit

Permalink
Merge pull request #199 from Niyiojeyinka/main
Browse files Browse the repository at this point in the history
Check directory exists, if not create...
  • Loading branch information
kitloong committed Feb 6, 2024
2 parents 3db2d95 + 5158c5f commit 0f007e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Migration/Writer/MigrationWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public function writeTo(

$use = implode(Space::LINE_BREAK(), $this->getNamespaces($migrationFileType, $useDBFacade));

// Create directory if it doesn't exist
$directory = dirname($path);

if (!File::exists($directory)) {
File::makeDirectory($directory, 0755, true);
}

File::put(
$path,
$this->migrationStub->populateStub($stub, $use, $className, $upString, $downString)
Expand Down

0 comments on commit 0f007e8

Please sign in to comment.