Skip to content

Commit 0f007e8

Browse files
authored
Merge pull request #199 from Niyiojeyinka/main
Check directory exists, if not create...
2 parents 3db2d95 + 5158c5f commit 0f007e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Migration/Writer/MigrationWriter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ public function writeTo(
5252

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

55+
// Create directory if it doesn't exist
56+
$directory = dirname($path);
57+
58+
if (!File::exists($directory)) {
59+
File::makeDirectory($directory, 0755, true);
60+
}
61+
5562
File::put(
5663
$path,
5764
$this->migrationStub->populateStub($stub, $use, $className, $upString, $downString)

0 commit comments

Comments
 (0)