mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Just a tad of cleanup
This commit is contained in:
parent
3f4b880e77
commit
1cbab36fda
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
namespace Flarum\Database;
|
namespace Flarum\Database;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Flarum\Extension\Extension;
|
use Flarum\Extension\Extension;
|
||||||
use Illuminate\Database\ConnectionResolverInterface as Resolver;
|
use Illuminate\Database\ConnectionResolverInterface as Resolver;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
|
@ -55,9 +56,9 @@ class Migrator
|
||||||
/**
|
/**
|
||||||
* Create a new migrator instance.
|
* Create a new migrator instance.
|
||||||
*
|
*
|
||||||
* @param \Flarum\Database\MigrationRepositoryInterface $repository
|
* @param MigrationRepositoryInterface $repository
|
||||||
* @param \Illuminate\Database\ConnectionResolverInterface $resolver
|
* @param Resolver $resolver
|
||||||
* @param \Illuminate\Filesystem\Filesystem $files
|
* @param Filesystem $files
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
MigrationRepositoryInterface $repository,
|
MigrationRepositoryInterface $repository,
|
||||||
|
@ -95,6 +96,7 @@ class Migrator
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param array $migrations
|
* @param array $migrations
|
||||||
* @param Extension $extension
|
* @param Extension $extension
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function runMigrationList($path, $migrations, Extension $extension = null)
|
public function runMigrationList($path, $migrations, Extension $extension = null)
|
||||||
{
|
{
|
||||||
|
@ -171,6 +173,7 @@ class Migrator
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param Extension $extension
|
* @param Extension $extension
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function runDown($path, $file, Extension $extension = null)
|
protected function runDown($path, $file, Extension $extension = null)
|
||||||
{
|
{
|
||||||
|
@ -191,14 +194,14 @@ class Migrator
|
||||||
*
|
*
|
||||||
* @param $migration
|
* @param $migration
|
||||||
* @param string $direction
|
* @param string $direction
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function runClosureMigration($migration, $direction = 'up')
|
protected function runClosureMigration($migration, $direction = 'up')
|
||||||
{
|
{
|
||||||
if (is_array($migration) && array_key_exists($direction, $migration)) {
|
if (is_array($migration) && array_key_exists($direction, $migration)) {
|
||||||
app()->call($migration[$direction]);
|
app()->call($migration[$direction]);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("Migration file should contain an array with up/down.");
|
throw new Exception('Migration file should contain an array with up/down.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user