Skip to content

Commit

Permalink
Merge pull request #46 from phalcon/fix/#40-array-2-string-conversion
Browse files Browse the repository at this point in the history
#40 - Fix notice with cleanup
  • Loading branch information
Jeckerson authored Feb 2, 2020
2 parents e7b7d2e + 597c56f commit 67ef5f8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public static function run(array $options)
$migrationsDirs[] = $migrationsDir;
foreach (ModelMigration::scanForVersions($migrationsDir) as $items) {
$items->setPath($migrationsDir);
$versionItems [] = $items;
$versionItems[] = $items;
}
}
} else {
Expand All @@ -260,14 +260,12 @@ public static function run(array $options)

$optionStack->setOption('tableName', $options['tableName'] ?? null, '@');

if (!isset($versionItems[0])) {
if (php_sapi_name() == 'cli') {
fwrite(STDERR, PHP_EOL . 'Migrations were not found at ' .
$optionStack->getOption('migrationsDir') . PHP_EOL);
exit;
} else {
throw new ModelException('Migrations were not found at ' . $optionStack->getOption('migrationsDir'));
}
if (empty($versionItems)) {
$migrationsPath = is_array($migrationsDirList) ?
join(PHP_EOL, $migrationsDirList) :
$migrationsDirList;

throw new ModelException('Migrations were not found at:' . PHP_EOL . PHP_EOL . $migrationsPath);
}

// Set default final version
Expand Down

0 comments on commit 67ef5f8

Please sign in to comment.