@@ -6,14 +6,14 @@ |
||
6 | 6 | |
7 | 7 | class MigrationCreator extends MC |
8 | 8 | { |
9 | - protected function getPath($name, $path) |
|
10 | - { |
|
11 | - $path = $path.'/'.date('Y').'/'.date('m'); |
|
9 | + protected function getPath($name, $path) |
|
10 | + { |
|
11 | + $path = $path.'/'.date('Y').'/'.date('m'); |
|
12 | 12 | |
13 | - if (! $this->files->exists($path)) { |
|
14 | - $this->files->makeDirectory($path, 0775, true); |
|
15 | - } |
|
13 | + if (! $this->files->exists($path)) { |
|
14 | + $this->files->makeDirectory($path, 0775, true); |
|
15 | + } |
|
16 | 16 | |
17 | - return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; |
|
18 | - } |
|
17 | + return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; |
|
18 | + } |
|
19 | 19 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $path = $path.'/'.date('Y').'/'.date('m'); |
12 | 12 | |
13 | - if (! $this->files->exists($path)) { |
|
13 | + if ( ! $this->files->exists($path)) { |
|
14 | 14 | $this->files->makeDirectory($path, 0775, true); |
15 | 15 | } |
16 | 16 |
@@ -8,76 +8,76 @@ |
||
8 | 8 | |
9 | 9 | class MigrateOrganise extends BaseCommand |
10 | 10 | { |
11 | - /** |
|
12 | - * The console command name. |
|
13 | - * |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $name = 'migrate:organise'; |
|
11 | + /** |
|
12 | + * The console command name. |
|
13 | + * |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $name = 'migrate:organise'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * The console command description. |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $description = 'Move migrations into a yyyy/mm folder structure'; |
|
18 | + /** |
|
19 | + * The console command description. |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $description = 'Move migrations into a yyyy/mm folder structure'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * The migrator instance. |
|
27 | - * |
|
28 | - * @var \Jaybizzle\MigrationsOrganiser\Migrator |
|
29 | - */ |
|
30 | - protected $migrator; |
|
25 | + /** |
|
26 | + * The migrator instance. |
|
27 | + * |
|
28 | + * @var \Jaybizzle\MigrationsOrganiser\Migrator |
|
29 | + */ |
|
30 | + protected $migrator; |
|
31 | 31 | |
32 | - /** |
|
33 | - * The filesystem instance. |
|
34 | - * |
|
35 | - * @var \Illuminate\Filesystem\Filesystem |
|
36 | - */ |
|
37 | - protected $files; |
|
32 | + /** |
|
33 | + * The filesystem instance. |
|
34 | + * |
|
35 | + * @var \Illuminate\Filesystem\Filesystem |
|
36 | + */ |
|
37 | + protected $files; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Create a new migrator instance. |
|
41 | - * |
|
42 | - * @param \Illuminate\Filesystem\Filesystem $files |
|
43 | - * @param \Illuminate\Database\Migrations\Migrator $migrator |
|
44 | - */ |
|
45 | - public function __construct(Filesystem $files, Migrator $migrator) |
|
46 | - { |
|
47 | - parent::__construct(); |
|
48 | - $this->migrator = $migrator; |
|
49 | - $this->files = $files; |
|
50 | - } |
|
39 | + /** |
|
40 | + * Create a new migrator instance. |
|
41 | + * |
|
42 | + * @param \Illuminate\Filesystem\Filesystem $files |
|
43 | + * @param \Illuminate\Database\Migrations\Migrator $migrator |
|
44 | + */ |
|
45 | + public function __construct(Filesystem $files, Migrator $migrator) |
|
46 | + { |
|
47 | + parent::__construct(); |
|
48 | + $this->migrator = $migrator; |
|
49 | + $this->files = $files; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Create date folder structure and move migrations into. |
|
54 | - * |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - public function fire() |
|
58 | - { |
|
59 | - $basePath = $this->getMigrationPath(); |
|
60 | - $migrations = $this->migrator->getMigrationFiles($basePath, false); |
|
61 | - $count = count($migrations); |
|
52 | + /** |
|
53 | + * Create date folder structure and move migrations into. |
|
54 | + * |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + public function fire() |
|
58 | + { |
|
59 | + $basePath = $this->getMigrationPath(); |
|
60 | + $migrations = $this->migrator->getMigrationFiles($basePath, false); |
|
61 | + $count = count($migrations); |
|
62 | 62 | |
63 | - if ($count == 0) { |
|
64 | - $this->comment('No migrations to move'); |
|
63 | + if ($count == 0) { |
|
64 | + $this->comment('No migrations to move'); |
|
65 | 65 | |
66 | - return; |
|
67 | - } |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - foreach ($migrations as $migration) { |
|
70 | - $datePath = $this->migrator->getDateFolderStructure($migration); |
|
69 | + foreach ($migrations as $migration) { |
|
70 | + $datePath = $this->migrator->getDateFolderStructure($migration); |
|
71 | 71 | |
72 | - // Create folder if it does not already exist |
|
73 | - if (! $this->files->exists($basePath.'/'.$datePath)) { |
|
74 | - $this->files->makeDirectory($basePath.'/'.$datePath, 0775, true); |
|
75 | - } |
|
72 | + // Create folder if it does not already exist |
|
73 | + if (! $this->files->exists($basePath.'/'.$datePath)) { |
|
74 | + $this->files->makeDirectory($basePath.'/'.$datePath, 0775, true); |
|
75 | + } |
|
76 | 76 | |
77 | - // Move the migration into its new folder |
|
78 | - $this->files->move($basePath.'/'.$migration.'.php', $basePath.'/'.$datePath.$migration.'.php'); |
|
79 | - } |
|
77 | + // Move the migration into its new folder |
|
78 | + $this->files->move($basePath.'/'.$migration.'.php', $basePath.'/'.$datePath.$migration.'.php'); |
|
79 | + } |
|
80 | 80 | |
81 | - $this->info('Migrations organised successfully ('.$count.' migrations moved)'); |
|
82 | - } |
|
81 | + $this->info('Migrations organised successfully ('.$count.' migrations moved)'); |
|
82 | + } |
|
83 | 83 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $datePath = $this->migrator->getDateFolderStructure($migration); |
71 | 71 | |
72 | 72 | // Create folder if it does not already exist |
73 | - if (! $this->files->exists($basePath.'/'.$datePath)) { |
|
73 | + if ( ! $this->files->exists($basePath.'/'.$datePath)) { |
|
74 | 74 | $this->files->makeDirectory($basePath.'/'.$datePath, 0775, true); |
75 | 75 | } |
76 | 76 |