Skip to content

Commit c7a2f8c

Browse files
committed
check directory exists
1 parent 3db2d95 commit c7a2f8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Migration/Writer/MigrationWriter.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ 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+
if (!File::isDirectory($directory)) {
58+
File::makeDirectory($directory, 0755, true, true);
59+
}
60+
5561
File::put(
5662
$path,
5763
$this->migrationStub->populateStub($stub, $use, $className, $upString, $downString)

0 commit comments

Comments
 (0)