Skip to content

Commit 0a0f5b2

Browse files
update
1 parent 2319709 commit 0a0f5b2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/.zencoder
1010
.env
1111
.htaccess
12-
.gitignore
1312
.user.ini
1413
composer.lock
1514
tame

src/Migrations/Migration.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public static function run()
8484
}
8585
}
8686

87+
// If there are no files, we'll display a warning message.
88+
self::noMigrationFound($files, $errorstatus, $errorMessage);
89+
8790
return new Collection([
8891
'status' => $errorstatus,
8992
'message' => implode("\n", $errorMessage)
@@ -148,10 +151,30 @@ public function drop($force = false)
148151
}
149152
}
150153

154+
// If there are no files, we'll display a warning message.
155+
self::noMigrationFound($files, $errorstatus, $errorMessage);
156+
151157
return new Collection([
152158
'status' => $errorstatus,
153159
'message' => implode("\n", $errorMessage)
154160
]);
155161
}
162+
163+
/**
164+
* If migration folder is empty, we will show this message
165+
*
166+
* @param array $files
167+
* @param mixed $errorstatus
168+
* @param mixed $errorMessage
169+
* @return void
170+
*/
171+
protected static function noMigrationFound($files, &$errorstatus, &$errorMessage)
172+
{
173+
// empty folders, means no migrations found
174+
if(empty($files)){
175+
$errorstatus = Constant::STATUS_400;
176+
$errorMessage[] = "No migration found";
177+
}
178+
}
156179

157180
}

0 commit comments

Comments
 (0)